test.mk 3.24 KB
Newer Older
1 2 3 4 5 6 7 8 9
# -----------------------------------------------------------------------------
# Examples of use:
#
# 	make		-- run all the tests in the current directory
# 	make verbose	-- as make test, but up the verbosity
# 	make accept	-- run the tests, accepting the current output
#
# The following variables may be set on the make command line:
#
10 11
#	TEST		-- specific test to run
#	TESTS		-- specific tests to run (same as $TEST really)
12 13 14
#	EXTRA_HC_OPTS	-- extra flags to send to the Haskell compiler
#	EXTRA_RUNTEST_OPTS -- extra flags to give the test driver
#	CONFIG		-- use a different configuration file
ross's avatar
ross committed
15
#	COMPILER	-- select a configuration file from config/
ei@vuokko.info's avatar
ei@vuokko.info committed
16
#       THREADS         -- run n tests at once
17 18 19
#
# -----------------------------------------------------------------------------

20 21
include $(TOP)/mk/wordsize.mk

22 23 24 25
ifeq "$(PYTHON)" ""
$(error Python must be installed in order to use the testsuite)
endif

dons's avatar
dons committed
26 27 28
# export the value of $MAKE for invocation in ghc-regress/driver/
export MAKE

rrt's avatar
rrt committed
29
# ghastly hack, because the driver requires that $tool be an absolute path name.
30 31 32
GHC_STAGE1_ABS	= $(GHC_COMPILER_DIR_ABS)/stage1/ghc-inplace
GHC_STAGE2_ABS	= $(GHC_COMPILER_DIR_ABS)/stage2/ghc-inplace
GHC_STAGE3_ABS	= $(GHC_COMPILER_DIR_ABS)/stage3/ghc-inplace
33

rrt's avatar
rrt committed
34 35
EXTRA_HC_OPTS += -D$(HostPlatform_CPP)
  # ideally TargetPlatform_CPP, but that doesn't exist; they're always the same anyway
36
RUNTESTS     = $(TOP)/driver/runtests.py
ross's avatar
ross committed
37 38
COMPILER     = ghc
CONFIG       = $(TOP)/config/$(COMPILER)
39 40

# can be overriden from the command line
41 42 43 44 45
ifneq "$(stage)" ""
TEST_HC = $(GHC_STAGE$(stage)_ABS)
else
TEST_HC = $(GHC_STAGE1_ABS)
endif
46

47
RUNTEST_OPTS =
48

49
ifeq "$(GhcWithNativeCodeGen)" "YES"
50 51 52
RUNTEST_OPTS += -e ghc_with_native_codegen=1
else
RUNTEST_OPTS += -e ghc_with_native_codegen=0
53 54
endif

55
ifeq "$(filter p, $(GhcLibWays))" "p"
56 57 58
RUNTEST_OPTS += -e ghc_with_profiling=1
else
RUNTEST_OPTS += -e ghc_with_profiling=0
59
endif
60

61 62 63 64 65 66
ifeq "$(filter u, $(GhcLibWays))" "u"
RUNTEST_OPTS += -e ghc_with_unreg=1
else
RUNTEST_OPTS += -e ghc_with_unreg=0
endif

67 68 69 70 71 72
ifeq "$(GhcWithInterpreter)" "YES"
RUNTEST_OPTS += -e ghc_with_interpreter=1
else
RUNTEST_OPTS += -e ghc_with_interpreter=0
endif

73 74 75 76 77 78
ifeq "$(filter thr, $(GhcRTSWays))" "thr"
RUNTEST_OPTS += -e ghc_with_threaded_rts=1
else
RUNTEST_OPTS += -e ghc_with_threaded_rts=0
endif

79 80 81 82 83 84
ifeq "$(GhcWithSMP)" "YES"
RUNTEST_OPTS += -e ghc_with_smp=1
else
RUNTEST_OPTS += -e ghc_with_smp=0
endif

ei@vuokko.info's avatar
ei@vuokko.info committed
85 86 87 88
ifneq "$(THREADS)" ""
RUNTEST_OPTS += --thread=$(THREADS)
endif

89 90 91 92 93
RUNTEST_OPTS +=  \
	--config=$(CONFIG) \
	-e config.compiler=\"$(TEST_HC)\" \
	-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
	-e config.platform=\"$(TARGETPLATFORM)\" \
94
	-e config.wordsize=\"$(WORDSIZE)\" \
95
	-e default_testopts.cleanup=\"$(CLEANUP)\" \
96
	-e config.timeout="int($(TIMEOUT)) or config.timeout" \
97
	-e config.timeout_prog=\"$(TOP)/timeout/timeout\" \
98 99
	$(EXTRA_RUNTEST_OPTS)

100 101 102 103 104 105 106 107 108 109 110 111
ifeq "$(fast)" "YES"
setfast = -e config.fast=1
else
setfast = 
endif

ifeq "$(accept)" "YES"
setaccept = -e config.accept=1
else
setaccept = 
endif

112
TESTS	     = 
113
TEST	     = 
114
WAY =
115 116 117 118

all :: test

test:
119 120
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
121
		$(patsubst %, --only=%, $(TESTS)) \
122
		$(patsubst %, --way=%, $(WAY)) \
123
		$(setfast) \
124
		$(setaccept)
125

126
verbose: test
127 128

accept:
129 130 131 132
	$(MAKE) accept=YES

fast:
	$(MAKE) fast=YES
133