test.mk 2.39 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 15 16 17
#	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
#
# -----------------------------------------------------------------------------

18 19 20 21
ifeq "$(PYTHON)" ""
$(error Python must be installed in order to use the testsuite)
endif

dons's avatar
dons committed
22 23 24
# export the value of $MAKE for invocation in ghc-regress/driver/
export MAKE

rrt's avatar
rrt committed
25
# ghastly hack, because the driver requires that $tool be an absolute path name.
26 27
GHC_INPLACE_ABS	= $(FPTOOLS_TOP_ABS)/ghc/compiler/ghc-inplace

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

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

36
RUNTEST_OPTS =
37

38
ifeq "$(GhcWithNativeCodeGen)" "YES"
39 40 41
RUNTEST_OPTS += -e ghc_with_native_codegen=1
else
RUNTEST_OPTS += -e ghc_with_native_codegen=0
42 43
endif

44
ifeq "$(filter p, $(GhcLibWays))" "p"
45 46 47
RUNTEST_OPTS += -e ghc_with_profiling=1
else
RUNTEST_OPTS += -e ghc_with_profiling=0
48
endif
49

50 51 52 53 54 55
ifeq "$(GhcWithInterpreter)" "YES"
RUNTEST_OPTS += -e ghc_with_interpreter=1
else
RUNTEST_OPTS += -e ghc_with_interpreter=0
endif

56 57 58 59 60 61
ifeq "$(filter thr, $(GhcRTSWays))" "thr"
RUNTEST_OPTS += -e ghc_with_threaded_rts=1
else
RUNTEST_OPTS += -e ghc_with_threaded_rts=0
endif

62 63 64 65 66 67 68
RUNTEST_OPTS +=  \
	--config=$(CONFIG) \
	-e config.compiler=\"$(TEST_HC)\" \
	-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
	-e config.platform=\"$(TARGETPLATFORM)\" \
	$(EXTRA_RUNTEST_OPTS)

69
TESTS	     = 
70
TEST	     = 
71
WAY          =
72 73 74 75

all :: test

test:
76 77
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
78 79
		$(patsubst %, --only=%, $(TESTS)) \
		$(patsubst %, --way=%, $(WAY))
80

81
verbose: test
82 83

accept:
84 85 86
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
		$(patsubst %, --only=%, $(TESTS)) \
87
		$(patsubst %, --way=%, $(WAY)) \
88
		-e config.accept=1
89