test.mk 3.77 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
#
# -----------------------------------------------------------------------------

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

23
RUNTESTS     = $(TOP)/driver/runtests.py
ross's avatar
ross committed
24
COMPILER     = ghc
25 26
CONFIGDIR    = $(TOP)/config
CONFIG       = $(CONFIGDIR)/$(COMPILER)
27

28 29 30 31 32 33 34
RUNTEST_OPTS =

$(eval $(call get-ghc-rts-field,WORDSIZE,Word size))
$(eval $(call get-ghc-rts-field,TARGETPLATFORM,Target platform))
$(eval $(call get-ghc-rts-field,TargetOS_CPP,Target OS))
ifeq "$(filter $(TargetOS_CPP), cygwin32 mingw32)" ""
exeext =
35
else
36
exeext = .exe
37
endif
38

39
$(eval $(call get-ghc-feature-bool,GhcWithNativeCodeGen,Have native code generator))
40
ifeq "$(GhcWithNativeCodeGen)" "YES"
41 42 43
RUNTEST_OPTS += -e ghc_with_native_codegen=1
else
RUNTEST_OPTS += -e ghc_with_native_codegen=0
44 45
endif

46
ifeq "$(filter p, $(GhcRTSWays))" "p"
47 48 49
RUNTEST_OPTS += -e ghc_with_profiling=1
else
RUNTEST_OPTS += -e ghc_with_profiling=0
50
endif
51

52 53 54 55 56 57 58
ifeq "$(filter thr, $(GhcRTSWays))" "thr"
RUNTEST_OPTS += -e ghc_with_threaded_rts=1
else
RUNTEST_OPTS += -e ghc_with_threaded_rts=0
endif

$(eval $(call get-ghc-feature-bool,GhcWithInterpreter,Have interpreter))
59 60 61 62 63 64
ifeq "$(GhcWithInterpreter)" "YES"
RUNTEST_OPTS += -e ghc_with_interpreter=1
else
RUNTEST_OPTS += -e ghc_with_interpreter=0
endif

65
$(eval $(call get-ghc-feature-bool,GhcUnregisterised,Unregisterised))
66 67 68 69 70 71
ifeq "$(GhcUnregisterised)" "YES"
RUNTEST_OPTS += -e ghc_unregisterised=1
else
RUNTEST_OPTS += -e ghc_unregisterised=0
endif

72
$(eval $(call get-ghc-feature-bool,GhcWithSMP,Support SMP))
73 74 75 76 77 78
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
79
ifneq "$(THREADS)" ""
80
RUNTEST_OPTS += --threads=$(THREADS)
ei@vuokko.info's avatar
ei@vuokko.info committed
81 82
endif

83
RUNTEST_OPTS +=  \
84
	--rootdir=. \
85
	--config=$(CONFIG) \
86
	-e config.confdir=\"$(CONFIGDIR)\" \
87 88
	-e config.compiler=\"$(TEST_HC)\" \
	-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
89
	-e config.ghc_pkg=\"$(GHC_PKG)\" \
90 91
	-e config.hp2ps=\"$(HP2PS_ABS)\" \
	-e config.gs=\"$(GS)\" \
92
	-e config.platform=\"$(TARGETPLATFORM)\" \
93
	-e config.os=\"$(TargetOS_CPP)\" \
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=\"$(TIMEOUT_PROGRAM)\" \
Ian Lynagh's avatar
Ian Lynagh committed
98
	-e config.exeext=\"$(exeext)\" \
99
	-e config.top=\"$(FPTOOLS_TOP_ABS)/testsuite\" \
100 101
	$(EXTRA_RUNTEST_OPTS)

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

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

114
TESTS	     = 
115
TEST	     = 
116
WAY =
117

118 119 120 121 122
.PHONY: all boot test verbose accept fast

all: test

boot: $(TIMEOUT_PROGRAM)
123

124
TIMEOUT_PROGRAM = $(TOP)/timeout/install-inplace/bin/timeout$(exeext)
125 126

$(TIMEOUT_PROGRAM) :
127 128 129
	@echo "Looks like you don't have timeout, building it first..."
	cd $(TOP)/timeout && $(MAKE) $(MFLAGS) all

130
test: $(TIMEOUT_PROGRAM)
131
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
132
		$(patsubst %, --only=%, $(TEST)) \
133
		$(patsubst %, --only=%, $(TESTS)) \
134
		$(patsubst %, --way=%, $(WAY)) \
135
		$(patsubst %, --skipway=%, $(SKIPWAY)) \
136
		$(setfast) \
137
		$(setaccept)
138

139
verbose: test
140 141

accept:
142 143 144
	$(MAKE) accept=YES

fast:
145
	$(MAKE) fast=YES
146