test.mk 2.58 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
GHC_INPLACE_ABS	= $(FPTOOLS_TOP_ABS)/ghc/compiler/ghc-inplace

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

# can be overriden from the command line
TEST_HC = $(GHC_INPLACE_ABS)

40
RUNTEST_OPTS =
41

42
ifeq "$(GhcWithNativeCodeGen)" "YES"
43 44 45
RUNTEST_OPTS += -e ghc_with_native_codegen=1
else
RUNTEST_OPTS += -e ghc_with_native_codegen=0
46 47
endif

48
ifeq "$(filter p, $(GhcLibWays))" "p"
49 50 51
RUNTEST_OPTS += -e ghc_with_profiling=1
else
RUNTEST_OPTS += -e ghc_with_profiling=0
52
endif
53

54 55 56 57 58 59
ifeq "$(GhcWithInterpreter)" "YES"
RUNTEST_OPTS += -e ghc_with_interpreter=1
else
RUNTEST_OPTS += -e ghc_with_interpreter=0
endif

60 61 62 63 64 65
ifeq "$(filter thr, $(GhcRTSWays))" "thr"
RUNTEST_OPTS += -e ghc_with_threaded_rts=1
else
RUNTEST_OPTS += -e ghc_with_threaded_rts=0
endif

66 67 68 69 70
RUNTEST_OPTS +=  \
	--config=$(CONFIG) \
	-e config.compiler=\"$(TEST_HC)\" \
	-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
	-e config.platform=\"$(TARGETPLATFORM)\" \
71
	-e config.wordsize=\"$(WORDSIZE)\" \
72
	-e default_testopts.cleanup=\"$(CLEANUP)\" \
73 74
	$(EXTRA_RUNTEST_OPTS)

75
TESTS	     = 
76
TEST	     = 
77
WAY          =
78 79 80 81

all :: test

test:
82 83
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
84 85
		$(patsubst %, --only=%, $(TESTS)) \
		$(patsubst %, --way=%, $(WAY))
86

87
verbose: test
88 89

accept:
90 91 92
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
		$(patsubst %, --only=%, $(TESTS)) \
93
		$(patsubst %, --way=%, $(WAY)) \
94
		-e config.accept=1
95