"s" is in GhcRTSWays now
[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 #
17 # -----------------------------------------------------------------------------
18
19 include $(TOP)/mk/wordsize.mk
20
21 ifeq "$(PYTHON)" ""
22 $(error Python must be installed in order to use the testsuite)
23 endif
24
25 # export the value of $MAKE for invocation in ghc-regress/driver/
26 export MAKE
27
28 # ghastly hack, because the driver requires that $tool be an absolute path name.
29 GHC_STAGE1_ABS = $(FPTOOLS_TOP_ABS)/ghc/compiler/stage1/ghc-inplace
30 GHC_STAGE2_ABS = $(FPTOOLS_TOP_ABS)/ghc/compiler/stage2/ghc-inplace
31 GHC_STAGE3_ABS = $(FPTOOLS_TOP_ABS)/ghc/compiler/stage3/ghc-inplace
32
33 EXTRA_HC_OPTS += -D$(HostPlatform_CPP)
34 # ideally TargetPlatform_CPP, but that doesn't exist; they're always the same anyway
35 RUNTESTS = $(TOP)/driver/runtests.py
36 COMPILER = ghc
37 CONFIG = $(TOP)/config/$(COMPILER)
38
39 # can be overriden from the command line
40 ifneq "$(stage)" ""
41 TEST_HC = $(GHC_STAGE$(stage)_ABS)
42 else
43 TEST_HC = $(GHC_STAGE1_ABS)
44 endif
45
46 RUNTEST_OPTS =
47
48 ifeq "$(GhcWithNativeCodeGen)" "YES"
49 RUNTEST_OPTS += -e ghc_with_native_codegen=1
50 else
51 RUNTEST_OPTS += -e ghc_with_native_codegen=0
52 endif
53
54 ifeq "$(filter p, $(GhcLibWays))" "p"
55 RUNTEST_OPTS += -e ghc_with_profiling=1
56 else
57 RUNTEST_OPTS += -e ghc_with_profiling=0
58 endif
59
60 ifeq "$(filter u, $(GhcLibWays))" "u"
61 RUNTEST_OPTS += -e ghc_with_unreg=1
62 else
63 RUNTEST_OPTS += -e ghc_with_unreg=0
64 endif
65
66 ifeq "$(filter s, $(GhcRTSWays))" "s"
67 RUNTEST_OPTS += -e ghc_with_smp=1
68 else
69 RUNTEST_OPTS += -e ghc_with_smp=0
70 endif
71
72 ifeq "$(GhcWithInterpreter)" "YES"
73 RUNTEST_OPTS += -e ghc_with_interpreter=1
74 else
75 RUNTEST_OPTS += -e ghc_with_interpreter=0
76 endif
77
78 ifeq "$(filter thr, $(GhcRTSWays))" "thr"
79 RUNTEST_OPTS += -e ghc_with_threaded_rts=1
80 else
81 RUNTEST_OPTS += -e ghc_with_threaded_rts=0
82 endif
83
84 RUNTEST_OPTS += \
85 --config=$(CONFIG) \
86 -e config.compiler=\"$(TEST_HC)\" \
87 -e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
88 -e config.platform=\"$(TARGETPLATFORM)\" \
89 -e config.wordsize=\"$(WORDSIZE)\" \
90 -e default_testopts.cleanup=\"$(CLEANUP)\" \
91 -e config.timeout_prog=\"$(TOP)/timeout/timeout\" \
92 $(EXTRA_RUNTEST_OPTS)
93
94 ifeq "$(fast)" "YES"
95 setfast = -e config.fast=1
96 else
97 setfast =
98 endif
99
100 ifeq "$(accept)" "YES"
101 setaccept = -e config.accept=1
102 else
103 setaccept =
104 endif
105
106 TESTS =
107 TEST =
108 WAY =
109
110 all :: test
111
112 test:
113 $(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
114 $(patsubst %, --only=%, $(TEST)) \
115 $(patsubst %, --only=%, $(TESTS)) \
116 $(patsubst %, --way=%, $(WAY)) \
117 $(setfast) \
118 $(setaccept)
119
120 verbose: test
121
122 accept:
123 $(MAKE) accept=YES
124
125 fast:
126 $(MAKE) fast=YES
127