Commit a0f8b238 authored by Simon Marlow's avatar Simon Marlow
Browse files

Make the testsuite work with the new build system

parent 51f05d57
TESTSUITE_TOP := $(TOP) TESTSUITE_TOP := $(TOP)
TOP:=$(TOP)/.. TOP:=$(TOP)/..
ifneq "$(wildcard $(TOP)/ghc.mk)" ""
NEWBUILD=YES
else
NEWBUILD=NO
endif
ifeq "$(NEWBUILD)" "YES"
FPTOOLS_TOP:=$(TOP)
include $(FPTOOLS_TOP)/mk/newconfig.mk
default : all
else
include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/boilerplate.mk
endif
TOP:=$(TESTSUITE_TOP) TOP:=$(TESTSUITE_TOP)
ifeq "$(NEWBUILD)" "NO"
TOP:=$(TOP)/.. TOP:=$(TOP)/..
include $(TOP)/mk/target.mk include $(TOP)/mk/target.mk
TOP:=$(TESTSUITE_TOP) TOP:=$(TESTSUITE_TOP)
endif
...@@ -38,14 +38,22 @@ COMPILER = ghc ...@@ -38,14 +38,22 @@ COMPILER = ghc
CONFIGDIR = $(TOP)/config CONFIGDIR = $(TOP)/config
CONFIG = $(CONFIGDIR)/$(COMPILER) CONFIG = $(CONFIGDIR)/$(COMPILER)
ifeq "$(NEWBUILD)" "YES"
# can be overriden from the command line # can be overriden from the command line
ifneq "$(stage)" "" ifneq "$(stage)" ""
TEST_HC = $(GHC_STAGE$(stage)_ABS)
else
TEST_HC = $(GHC_STAGE2_ABS)
endif
GHC_PKG = $(FPTOOLS_TOP_ABS)/$(GHC_PKG_INPLACE)
else
ifneq "$(stage)" ""
TEST_HC = $(GHC_STAGE$(stage)) TEST_HC = $(GHC_STAGE$(stage))
else else
TEST_HC = $(GHC_STAGE2) TEST_HC = $(GHC_STAGE2)
endif endif
GHC_PKG = $(GHC_PKG_INPLACE) GHC_PKG = $(GHC_PKG_INPLACE)
endif
RUNTEST_OPTS = RUNTEST_OPTS =
...@@ -130,9 +138,23 @@ WAY = ...@@ -130,9 +138,23 @@ WAY =
all :: test all :: test
TIMEOUT_PROGRAM = $(TOP)/timeout/install-inplace/bin/timeout$(exeext) ifeq "$(NEWBUILD)" "YES"
timeout : $(TIMEOUT_PROGRAM) TIMEOUT_PROGRAM = $(FPTOOLS_TOP)/inplace/bin/timeout$(exeext)
$(TIMEOUT_PROGRAM) :
@echo "Looks like you don't have timeout, building it first..."
cd $(FPTOOLS_TOP) && $(MAKE) $(MFLAGS) inplace/bin/timeout$(exeext)
pwd : $(FPTOOLS_TOP)/utils/pwd$(exeext)
$(FPTOOLS_TOP)/utils/pwd$(exeext) :
@echo "Looks like you don't have pwd, building utils first..."
cd $(FPTOOLS_TOP) && $(MAKE) $(MFLAGS) utils/pwd$(exeext)
else
TIMEOUT_PROGRAM = $(TOP)/timeout/install-inplace/bin/timeout$(exeext)
$(TIMEOUT_PROGRAM) : $(TIMEOUT_PROGRAM) :
@echo "Looks like you don't have timeout, building it first..." @echo "Looks like you don't have timeout, building it first..."
...@@ -140,11 +162,12 @@ $(TIMEOUT_PROGRAM) : ...@@ -140,11 +162,12 @@ $(TIMEOUT_PROGRAM) :
pwd : $(TOP)/utils/pwd$(exeext) pwd : $(TOP)/utils/pwd$(exeext)
$(TOP)/utils/pwd$(exeext) : -$(TOP)/utils/pwd$(exeext) :
@echo "Looks like you don't have pwd, building utils first..." @echo "Looks like you don't have pwd, building utils first..."
cd $(TOP)/utils && $(MAKE) $(MFLAGS) all cd $(TOP)/utils && $(MAKE) $(MFLAGS) all
endif
test: timeout pwd test: $(TIMEOUT_PROGRAM) pwd
$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \ $(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
$(patsubst %, --only=%, $(TEST)) \ $(patsubst %, --only=%, $(TEST)) \
$(patsubst %, --only=%, $(TESTS)) \ $(patsubst %, --only=%, $(TESTS)) \
...@@ -160,4 +183,3 @@ accept: ...@@ -160,4 +183,3 @@ accept:
fast: fast:
$(MAKE) fast=YES $(MAKE) fast=YES
...@@ -4,7 +4,12 @@ include $(TOP)/mk/test.mk ...@@ -4,7 +4,12 @@ include $(TOP)/mk/test.mk
# The libraries that we actually know about. We don't want to test # The libraries that we actually know about. We don't want to test
# extralibs that are in our tree but which we haven't built. # extralibs that are in our tree but which we haven't built.
LIBRARIES := $(shell $(GHC_PKG_PROG) list --simple-output --names-only) ifeq "$(NEWBUILD)" "YES"
LIBRARIES := $(shell $(FPTOOLS_TOP_ABS)/$(GHC_PKG_INPLACE) list --simple-output --names-only)
else
LIBRARIES := $(shell $(GHC_PKG) list --simple-output --names-only)
endif
# Now find the "tests" directories of those libraries, where they exist # Now find the "tests" directories of those libraries, where they exist
LIBRARY_TEST_PATHS := $(wildcard $(patsubst %, $(FPTOOLS_TOP)/libraries/%/tests, $(LIBRARIES))) LIBRARY_TEST_PATHS := $(wildcard $(patsubst %, $(FPTOOLS_TOP)/libraries/%/tests, $(LIBRARIES)))
......
TIMEOUT_PROGRAM = $(INPLACE_BIN)/timeout$(exeext)
ifeq "$(findstring thr,$(GhcRTSWays))" ""
$(TIMEOUT_PROGRAM): testsuite/timeout/timeout.py
$(MKDIRHIER) `dirname $@`
cp $< $@
chmod +x $@
else
testsuite/timeout_dist_MODULES = Main WinCBindings
testsuite/timeout_dist_PROG = timeout
testsuite/timeout_dist_DEP_INCLUDE_DIRS = $(GHC_INCLUDE_DIR)
testsuite/timeout_HC_OPTS = -threaded -XCPP -package process
ifeq "$(Windows)" "YES"
testsuite/timeout_HC_OPTS += -package Win32
else
testsuite/timeout_HC_OPTS += -package unix
endif
# XXX when GHC generates dependencies it uses the module name, not the
# filename, so we get dependencies on Main.o rather than timeout.o.
# If we don't fix this, timeout gets compiled before the libraries.
testsuite/timeout/dist/build/Main.hs : testsuite/timeout/timeout.hs $(MKDIRHIER)
@$(MKDIRHIER) $(dir $@)
$(CP) $< $@
$(eval $(call build-prog,testsuite/timeout,dist,1))
endif
all : testsuite/timeout/calibrate.out
# depend on $(GHC_STAGE2) so we can be sure all the libs are built
testsuite/timeout/calibrate.out: $(GHC_STAGE2)
$(RM) -f testsuite/timeout/TimeMe.o testsuite/timeout/TimeMe.hi testsuite/timeout/TimeMe testsuite/timeout/TimeMe.exe
cd testsuite/timeout && $(PYTHON) calibrate "$(GHC_STAGE1_ABS)" > ../../$@
CLEAN_FILES += testsuite/timeout/calibrate.out
# We use stage 1 to do the calibration, as stage 2 may not exist.
# This isn't necessarily the compiler we'll be running the testsuite
# with, but it's really the performance of the machine that we're
# interested in
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment