test.mk 2.17 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

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

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

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

33
RUNTEST_OPTS =
34

35
ifeq "$(GhcWithNativeCodeGen)" "YES"
36 37 38
RUNTEST_OPTS += -e ghc_with_native_codegen=1
else
RUNTEST_OPTS += -e ghc_with_native_codegen=0
39 40
endif

41
ifeq "$(filter p, $(GhcLibWays))" "p"
42 43 44
RUNTEST_OPTS += -e ghc_with_profiling=1
else
RUNTEST_OPTS += -e ghc_with_profiling=0
45
endif
46

47 48 49 50 51 52
ifeq "$(GhcWithInterpreter)" "YES"
RUNTEST_OPTS += -e ghc_with_interpreter=1
else
RUNTEST_OPTS += -e ghc_with_interpreter=0
endif

53 54 55 56 57 58 59
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)

60
TESTS	     = 
61
TEST	     = 
62
WAY          =
63 64 65 66

all :: test

test:
67 68
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
69 70
		$(patsubst %, --only=%, $(TESTS)) \
		$(patsubst %, --way=%, $(WAY))
71

72
verbose: test
73 74

accept:
75 76 77
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
		$(patsubst %, --only=%, $(TESTS)) \
78
		$(patsubst %, --way=%, $(WAY)) \
79
		-e config.accept=1
80