Testsuite: don't warn about missing specialisations
[ghc.git] / testsuite / mk / test.mk
1 # -----------------------------------------------------------------------------
2 # Examples of use:
3 #
4 # make -- run all the tests in the current directory
5 # make verbose -- as make test, but up the verbosity
6 # make accept -- run the tests, accepting the current output
7 #
8 # The following variables may be set on the make command line:
9 #
10 # TEST -- specific test to run
11 # TESTS -- specific tests to run (same as $TEST really)
12 # EXTRA_HC_OPTS -- extra flags to send to the Haskell compiler
13 # EXTRA_RUNTEST_OPTS -- extra flags to give the test driver
14 # CONFIG -- use a different configuration file
15 # COMPILER -- select a configuration file from config/
16 # THREADS -- run n tests at once
17 #
18 # -----------------------------------------------------------------------------
19
20 # export the value of $MAKE for invocation in tests/driver/
21 export MAKE
22
23 RUNTESTS = $(TOP)/driver/runtests.py
24 COMPILER = ghc
25 CONFIGDIR = $(TOP)/config
26 CONFIG = $(CONFIGDIR)/$(COMPILER)
27
28 ifeq "$(GhcUnregisterised)" "YES"
29 # Otherwise C backend generates many warnings about
30 # imcompatible proto casts for GCC's buitins:
31 # memcpy, printf, strlen.
32 EXTRA_HC_OPTS += -optc-fno-builtin
33 endif
34
35 # TEST_HC_OPTS is passed to every invocation of TEST_HC
36 # in nested Makefiles
37 TEST_HC_OPTS = -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS)
38
39 # The warning suppression flag below is a temporary kludge. While working with
40 # tests that contain tabs, please de-tab them so this flag can be eventually
41 # removed. See
42 # http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
43 # for details
44 #
45 TEST_HC_OPTS += -fno-warn-tabs
46
47 # Don't warn about missing specialisations. They can only occur with `-O`, but
48 # we want tests to produce the same output for all test ways.
49 TEST_HC_OPTS += -fno-warn-missed-specialisations
50
51 RUNTEST_OPTS =
52
53 ifeq "$(filter $(TargetOS_CPP), cygwin32 mingw32)" ""
54 exeext =
55 else
56 exeext = .exe
57 endif
58
59 ifneq "$(filter $(TargetOS_CPP),cygwin32 mingw32)" ""
60 dllext = .dll
61 else ifeq "$(TargetOS_CPP)" "darwin"
62 dllext = .dylib
63 else
64 dllext = .so
65 endif
66
67 RUNTEST_OPTS += -e ghc_compiler_always_flags="'$(TEST_HC_OPTS)'"
68
69 RUNTEST_OPTS += -e ghc_debugged=$(GhcDebugged)
70
71 ifeq "$(GhcWithNativeCodeGen)" "YES"
72 RUNTEST_OPTS += -e ghc_with_native_codegen=1
73 else
74 RUNTEST_OPTS += -e ghc_with_native_codegen=0
75 endif
76
77 GHC_PRIM_LIBDIR := $(subst library-dirs: ,,$(shell "$(GHC_PKG)" field ghc-prim library-dirs --simple-output))
78 HAVE_VANILLA := $(shell if [ -f $(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.hi ]; then echo YES; else echo NO; fi)
79 HAVE_DYNAMIC := $(shell if [ -f $(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.dyn_hi ]; then echo YES; else echo NO; fi)
80 HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.p_hi ]; then echo YES; else echo NO; fi)
81
82 ifeq "$(HAVE_VANILLA)" "YES"
83 RUNTEST_OPTS += -e ghc_with_vanilla=1
84 else
85 RUNTEST_OPTS += -e ghc_with_vanilla=0
86 endif
87
88 ifeq "$(HAVE_DYNAMIC)" "YES"
89 RUNTEST_OPTS += -e ghc_with_dynamic=1
90 else
91 RUNTEST_OPTS += -e ghc_with_dynamic=0
92 endif
93
94 ifeq "$(HAVE_PROFILING)" "YES"
95 RUNTEST_OPTS += -e ghc_with_profiling=1
96 else
97 RUNTEST_OPTS += -e ghc_with_profiling=0
98 endif
99
100 ifeq "$(filter thr, $(GhcRTSWays))" "thr"
101 RUNTEST_OPTS += -e ghc_with_threaded_rts=1
102 else
103 RUNTEST_OPTS += -e ghc_with_threaded_rts=0
104 endif
105
106 ifeq "$(filter dyn, $(GhcRTSWays))" "dyn"
107 RUNTEST_OPTS += -e ghc_with_dynamic_rts=1
108 else
109 RUNTEST_OPTS += -e ghc_with_dynamic_rts=0
110 endif
111
112 ifeq "$(GhcWithInterpreter)" "NO"
113 RUNTEST_OPTS += -e ghc_with_interpreter=0
114 else ifeq "$(GhcStage)" "1"
115 RUNTEST_OPTS += -e ghc_with_interpreter=0
116 else
117 RUNTEST_OPTS += -e ghc_with_interpreter=1
118 endif
119
120 ifeq "$(GhcUnregisterised)" "YES"
121 RUNTEST_OPTS += -e ghc_unregisterised=1
122 else
123 RUNTEST_OPTS += -e ghc_unregisterised=0
124 endif
125
126 ifeq "$(GhcDynamicByDefault)" "YES"
127 RUNTEST_OPTS += -e ghc_dynamic_by_default=True
128 CABAL_MINIMAL_BUILD = --enable-shared --disable-library-vanilla
129 else
130 RUNTEST_OPTS += -e ghc_dynamic_by_default=False
131 CABAL_MINIMAL_BUILD = --enable-library-vanilla --disable-shared
132 endif
133
134 ifeq "$(GhcDynamic)" "YES"
135 RUNTEST_OPTS += -e ghc_dynamic=True
136 CABAL_PLUGIN_BUILD = --enable-shared --disable-library-vanilla
137 else
138 RUNTEST_OPTS += -e ghc_dynamic=False
139 CABAL_PLUGIN_BUILD = --enable-library-vanilla --disable-shared
140 endif
141
142 ifeq "$(GhcWithSMP)" "YES"
143 RUNTEST_OPTS += -e ghc_with_smp=1
144 else
145 RUNTEST_OPTS += -e ghc_with_smp=0
146 endif
147
148 ifeq "$(LLC)" ""
149 RUNTEST_OPTS += -e ghc_with_llvm=0
150 else ifneq "$(LLC)" "llc"
151 # If we have a real detected value for LLVM, then it really ought to work
152 RUNTEST_OPTS += -e ghc_with_llvm=1
153 else ifneq "$(shell $(SHELL) -c 'llc --version | grep version' 2> /dev/null)" ""
154 RUNTEST_OPTS += -e ghc_with_llvm=1
155 else
156 RUNTEST_OPTS += -e ghc_with_llvm=0
157 endif
158
159 ifeq "$(WINDOWS)" "YES"
160 RUNTEST_OPTS += -e windows=True
161 else
162 RUNTEST_OPTS += -e windows=False
163 endif
164
165 ifeq "$(DARWIN)" "YES"
166 RUNTEST_OPTS += -e darwin=True
167 else
168 RUNTEST_OPTS += -e darwin=False
169 endif
170
171 ifeq "$(IN_TREE_COMPILER)" "YES"
172 RUNTEST_OPTS += -e in_tree_compiler=True
173 else
174 RUNTEST_OPTS += -e in_tree_compiler=False
175 endif
176
177 ifneq "$(THREADS)" ""
178 RUNTEST_OPTS += --threads=$(THREADS)
179 endif
180
181 ifneq "$(VERBOSE)" ""
182 RUNTEST_OPTS += --verbose=$(VERBOSE)
183 endif
184
185 ifeq "$(SKIP_PERF_TESTS)" "YES"
186 RUNTEST_OPTS += --skip-perf-tests
187 endif
188
189 ifneq "$(CLEAN_ONLY)" ""
190 RUNTEST_OPTS += -e clean_only=True
191 else
192 RUNTEST_OPTS += -e clean_only=False
193 endif
194
195 ifneq "$(CHECK_FILES_WRITTEN)" ""
196 RUNTEST_OPTS += --check-files-written
197 endif
198
199 RUNTEST_OPTS += \
200 --rootdir=. \
201 --configfile=$(CONFIG) \
202 -e 'config.confdir="$(CONFIGDIR)"' \
203 -e 'config.platform="$(TARGETPLATFORM)"' \
204 -e 'config.os="$(TargetOS_CPP)"' \
205 -e 'config.arch="$(TargetARCH_CPP)"' \
206 -e 'config.wordsize="$(WORDSIZE)"' \
207 -e 'default_testopts.cleanup="$(CLEANUP)"' \
208 -e 'config.timeout=int($(TIMEOUT)) or config.timeout' \
209 -e 'config.exeext="$(exeext)"' \
210 -e 'config.top="$(TOP_ABS)"'
211
212 # Wrap non-empty program paths in quotes, because they may contain spaces. Do
213 # it here, so we don't have to (and don't forget to do it) in the .T test
214 # scripts (search for '{compiler}' or '{hpc}'). This may or may not be a good
215 # idea.
216 # Use `--config` instead of `-e`, because `-e` (which calls Python's `eval`
217 # function) would require another pair of (escaped) quotes, which interfers
218 # with MinGW's magic path handling (see #10449, and
219 # http://www.mingw.org/wiki/Posix_path_conversion).
220 # We use double instead of single quotes, which may or may not be important
221 # when using msys2 (#9626, #10441).
222 quote_path = $(if $1,"$1")
223 RUNTEST_OPTS += \
224 --config 'compiler=$(call quote_path,$(TEST_HC))' \
225 --config 'ghc_pkg=$(call quote_path,$(GHC_PKG))' \
226 --config 'haddock=$(call quote_path,$(HADDOCK))' \
227 --config 'hp2ps=$(call quote_path,$(HP2PS_ABS))' \
228 --config 'hpc=$(call quote_path,$(HPC))' \
229 --config 'gs=$(call quote_path,$(GS))' \
230 --config 'timeout_prog=$(call quote_path,$(TIMEOUT_PROGRAM))'
231
232 ifneq "$(SUMMARY_FILE)" ""
233 RUNTEST_OPTS += \
234 --summary-file "$(SUMMARY_FILE)"
235 endif
236 ifeq "$(NO_PRINT_SUMMARY)" "YES"
237 RUNTEST_OPTS += \
238 --no-print-summary 1
239 endif
240
241 RUNTEST_OPTS += \
242 $(EXTRA_RUNTEST_OPTS)
243
244 ifeq "$(list_broken)" "YES"
245 set_list_broken = -e config.list_broken=True
246 else
247 set_list_broken =
248 endif
249
250 ifeq "$(fast)" "YES"
251 setfast = -e config.fast=1
252 else
253 setfast =
254 endif
255
256 ifeq "$(accept)" "YES"
257 setaccept = -e config.accept=1
258 else
259 setaccept =
260 endif
261
262 .PHONY: all boot test verbose accept fast list_broken
263
264 all: test
265
266 TIMEOUT_PROGRAM = $(TOP)/timeout/install-inplace/bin/timeout$(exeext)
267
268 boot: $(TIMEOUT_PROGRAM)
269
270 $(TIMEOUT_PROGRAM) :
271 @echo "Looks like you don't have timeout, building it first..."
272 $(MAKE) -C $(TOP)/timeout all
273
274 test: $(TIMEOUT_PROGRAM)
275 $(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
276 $(patsubst %, --only=%, $(TEST)) \
277 $(patsubst %, --only=%, $(TESTS)) \
278 $(patsubst %, --way=%, $(WAY)) \
279 $(patsubst %, --skipway=%, $(SKIPWAY)) \
280 $(set_list_broken) \
281 $(setfast) \
282 $(setaccept)
283
284 verbose: test
285
286 accept:
287 $(MAKE) accept=YES
288
289 fast:
290 $(MAKE) fast=YES
291
292 list_broken:
293 $(MAKE) list_broken=YES
294