test.mk 1.83 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 33 34 35 36 37 38 39 40 41 42 43
RUNTESTS     = $(TOP)/driver/runtests.py
CONFIG       = $(TOP)/config/ghc

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

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)

ifeq "$(filter p, $(GhcLibWays))" "p"
RUNTEST_OPTS += -e config.compile_ways.append"(\"prof\")"
RUNTEST_OPTS += -e config.run_ways.append"(\"prof\")"
endif
44

45
TESTS	     = 
46
TEST	     = 
47 48 49 50

all :: test

test:
51 52 53
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
		$(patsubst %, --only=%, $(TESTS))
54

55
verbose: test
56 57

accept:
58 59 60 61
	$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
		$(patsubst %, --only=%, $(TEST)) \
		$(patsubst %, --only=%, $(TESTS)) \
		-e config.accept=1
62