test.mk 2.97 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/
16 17 18
#
# -----------------------------------------------------------------------------

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

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

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

rrt's avatar
rrt committed
28
# ghastly hack, because the driver requires that $tool be an absolute path name.
29 30 31
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
32

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

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

46
RUNTEST_OPTS =
47

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

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

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

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

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

78 79 80 81 82
RUNTEST_OPTS +=  \
	--config=$(CONFIG) \
	-e config.compiler=\"$(TEST_HC)\" \
	-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
	-e config.platform=\"$(TARGETPLATFORM)\" \
83
	-e config.wordsize=\"$(WORDSIZE)\" \
84
	-e default_testopts.cleanup=\"$(CLEANUP)\" \
85
	-e config.timeout_prog=\"$(TOP)/timeout/timeout\" \
86 87
	$(EXTRA_RUNTEST_OPTS)

88 89 90 91 92 93 94 95 96 97 98 99
ifeq "$(fast)" "YES"
setfast = -e config.fast=1
else
setfast = 
endif

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

100
TESTS	     = 
101
TEST	     = 
102
WAY =
103 104 105 106

all :: test

test:
107 108
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
109
		$(patsubst %, --only=%, $(TESTS)) \
110
		$(patsubst %, --way=%, $(WAY)) \
111
		$(setfast) \
112
		$(setaccept)
113

114
verbose: test
115 116

accept:
117 118 119 120
	$(MAKE) accept=YES

fast:
	$(MAKE) fast=YES
121