Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
2117cc22
Commit
2117cc22
authored
Jan 08, 2009
by
Ian Lynagh
Browse files
Disentangle the testsuite from the compiler's build system
parent
e6fc6a9c
Changes
9
Hide whitespace changes
Inline
Side-by-side
testsuite/mk/boilerplate.mk
View file @
2117cc22
TESTSUITE_TOP
:=
$(TOP)
TOP
:=
$(TOP)
/..
ifneq
"$(wildcard $(TOP)/ghc.mk)" ""
NEWBUILD
=
YES
# XXX This whole file should disappear
# New build system:
# include mk/newconfig.mk
# default : all
# Old build system:
# include mk/boilerplate.mk
default
:
all
define
get-ghc-rts-field
# $1 = rseult variable, $2 = field name
$1
:=
$
$(
shell
$
$(TEST_HC)
+RTS
--info
|
grep
'^ .("$2",'
|
sed
-e
's/.*", *"//'
-e
's/"
)
$$$$//'
)
endef
define
get-ghc-field
# $1 = rseult variable, $2 = field name
$1
:=
$
$(
shell
$
$(TEST_HC)
--info
|
grep
'^ .("$2",'
|
sed
-e
's/.*", *"//'
-e
's/"
)
$$$$//'
)
endef
define
get-ghc-feature-bool
# $1 = rseult variable, $2 = field name
SHELL_RES
:=
$
$(
shell
$
$(TEST_HC)
--info
|
grep
'^ .("$2",'
|
sed
-e
's/.*", *"//'
-e
's/"
)
$$$$//'
)
$1
:=
$
$(
strip
\
$
$(
if
$
$(SHELL_RES)
,
\
$
$(
if
$
$(
subst
YES,,
$
$(SHELL_RES)
)
,
\
$
$(
if
$
$(
subst
NO,,
$
$(SHELL_RES)
)
,
\
$
$(
warning
ghc info field not YES or NO:
$2
:
$
$(SHELL_RES)
)
,
\
NO
)
,
\
YES
)
,
\
$
$(
warning
ghc info field not found:
$2
)))
endef
ifeq
"$(TEST_HC)" ""
OLD_BUILD_SYSTEM_STAGE1_GHC
:=
$(
abspath
$(TOP)
/../ghc/stage1-inplace/ghc
)
OLD_BUILD_SYSTEM_STAGE2_GHC
:=
$(
abspath
$(TOP)
/../ghc/stage2-inplace/ghc
)
OLD_BUILD_SYSTEM_STAGE3_GHC
:=
$(
abspath
$(TOP)
/../ghc/stage3-inplace/ghc
)
OLD_BUILD_SYSTEM_GHC_PKG
:=
$(
abspath
$(TOP)
/../utils/ghc-pkg/install-inplace/bin/ghc-pkg
)
OLD_BUILD_SYSTEM_HP2PS
:=
$(
abspath
$(TOP)
/../utils/hp2ps/hp2ps
)
ifneq
"$(wildcard $(OLD_BUILD_SYSTEM_STAGE1_GHC))" ""
ifeq
"$(stage)" "1"
TEST_HC
:=
$(OLD_BUILD_SYSTEM_STAGE1_GHC)
else
ifeq
"$(stage)" "3"
TEST_HC
:=
$(OLD_BUILD_SYSTEM_STAGE3_GHC)
else
NEWBUILD
=
NO
# use stage2 by default
TEST_HC
:=
$(OLD_BUILD_SYSTEM_STAGE2_GHC)
endif
GHC_PKG
:=
$(OLD_BUILD_SYSTEM_GHC_PKG)
HP2PS_ABS
:=
$(OLD_BUILD_SYSTEM_HP2PS)
endif
ifeq
"$(NEWBUILD)" "YES"
else
NEW_BUILD_SYSTEM_STAGE1_GHC
:=
$(
abspath
$(TOP)
/../inplace/bin/ghc-stage1
)
NEW_BUILD_SYSTEM_STAGE2_GHC
:=
$(
abspath
$(TOP)
/../inplace/bin/ghc-stage2
)
NEW_BUILD_SYSTEM_STAGE3_GHC
:=
$(
abspath
$(TOP)
/../inplace/bin/ghc-stage3
)
ifneq
"$(wildcard $(NEW_BUILD_SYSTEM_STAGE1_GHC))" ""
FPTOOLS_TOP
:=
$(TOP)
include
$(FPTOOLS_TOP)/mk/newconfig.mk
else
TEST_HC
:=
$(
shell
which ghc
)
endif
endif
endif
default
:
all
ifeq
"$(GHC_PKG)" ""
GHC_PKG
:=
$(
dir
$(TEST_HC)
)
/ghc-pkg
endif
else
ifeq
"$(HP2PS_ABS)" ""
HP2PS_ABS
:=
$(
dir
$(TEST_HC)
)
/hp2ps
endif
ifeq
"$(wildcard $(TEST_HC))" ""
$(error
Cannot
find
ghc)
endif
include
$(TOP)/mk/boilerplate.mk
ifeq
"$(wildcard $(GHC_PKG))" ""
$(error
Cannot
find
ghc-pkg)
endif
ifeq
"$(wildcard $(HP2PS_ABS))" ""
$(error
Cannot
find
hp2ps)
endif
TOP
:=
$(TESTSUITE_TOP)
$(eval
$(call
get-ghc-field,GhcRTSWays,RTS
ways))
GS
=
gs
CP
=
cp
RM
=
rm
-f
PYTHON
=
/usr/bin/python
testsuite/mk/test.mk
View file @
2117cc22
...
...
@@ -17,76 +17,59 @@
#
# -----------------------------------------------------------------------------
include
$(TOP)/mk/wordsize.mk
$(TOP)/mk/wordsize.mk
:
$(TOP)/mk/wordsize.mk.in
$(CPP)
$(RAWCPP_FLAGS)
-x
c
$(TOP)
/mk/wordsize.mk.in
>
$(TOP)
/mk/wordsize.mk
ifeq
"$(PYTHON)" ""
$(error
Python
must
be
installed
in
order
to
use
the
testsuite)
endif
# export the value of $MAKE for invocation in ghc-regress/driver/
export
MAKE
# ghastly hack, because the driver requires that $tool be an absolute path name.
HP2PS_ABS
=
$(GHC_HP2PS_DIR_ABS)
/hp2ps
GS
=
gs
RUNTESTS
=
$(TOP)
/driver/runtests.py
COMPILER
=
ghc
CONFIGDIR
=
$(TOP)
/config
CONFIG
=
$(CONFIGDIR)
/
$(COMPILER)
ifeq
"$(NEWBUILD)" "YES"
# can be overriden from the command line
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)
)
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
=
else
TEST_HC
=
$(GHC_STAGE2)
exeext
=
.exe
endif
GHC_PKG
=
$(GHC_PKG_INPLACE)
endif
RUNTEST_OPTS
=
$(eval
$(call
get-ghc-feature-bool,GhcWithNativeCodeGen,Have
native
code
generator))
ifeq
"$(GhcWithNativeCodeGen)" "YES"
RUNTEST_OPTS
+=
-e
ghc_with_native_codegen
=
1
else
RUNTEST_OPTS
+=
-e
ghc_with_native_codegen
=
0
endif
ifeq
"$(filter p, $(Ghc
Lib
Ways))" "p"
ifeq
"$(filter p, $(Ghc
RTS
Ways))" "p"
RUNTEST_OPTS
+=
-e
ghc_with_profiling
=
1
else
RUNTEST_OPTS
+=
-e
ghc_with_profiling
=
0
endif
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))
ifeq
"$(GhcWithInterpreter)" "YES"
RUNTEST_OPTS
+=
-e
ghc_with_interpreter
=
1
else
RUNTEST_OPTS
+=
-e
ghc_with_interpreter
=
0
endif
$(eval
$(call
get-ghc-feature-bool,GhcUnregisterised,Unregisterised))
ifeq
"$(GhcUnregisterised)" "YES"
RUNTEST_OPTS
+=
-e
ghc_unregisterised
=
1
else
RUNTEST_OPTS
+=
-e
ghc_unregisterised
=
0
endif
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,GhcWithSMP,Support
SMP))
ifeq
"$(GhcWithSMP)" "YES"
RUNTEST_OPTS
+=
-e
ghc_with_smp
=
1
else
...
...
@@ -102,7 +85,6 @@ RUNTEST_OPTS += \
--config
=
$(CONFIG)
\
-e
config.confdir
=
\"
$(CONFIGDIR)
\"
\
-e
config.compiler
=
\"
$(TEST_HC)
\"
\
-e
config.compiler_always_flags.append
"(
\"
-D
$(HostPlatform_CPP)
\"
)"
\
-e
config.compiler_always_flags.append
"(
\"
$(EXTRA_HC_OPTS)
\"
)"
\
-e
config.ghc_pkg
=
\"
$(GHC_PKG)
\"
\
-e
config.hp2ps
=
\"
$(HP2PS_ABS)
\"
\
...
...
@@ -117,9 +99,6 @@ RUNTEST_OPTS += \
-e
config.top
=
\"
$(FPTOOLS_TOP_ABS)
/testsuite
\"
\
$(EXTRA_RUNTEST_OPTS)
# HostPlatform_CPP should ideally be TargetPlatform_CPP, but that
# doesn't exist; they're always the same anyway
ifeq
"$(fast)" "YES"
setfast
=
-e
config.fast
=
1
else
...
...
@@ -138,36 +117,13 @@ WAY =
all
::
test
ifeq
"$(NEWBUILD)" "YES"
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)
:
@
echo
"Looks like you don't have timeout, building it first..."
cd
$(TOP)
/timeout
&&
$(MAKE)
$(MFLAGS)
all
pwd
:
$(TOP)/utils/pwd$(exeext)
$(TOP)/utils/pwd$(exeext)
:
@
echo
"Looks like you don't have pwd, building utils first..."
cd
$(TOP)
/utils
&&
$(MAKE)
$(MFLAGS)
all
endif
test
:
$(TIMEOUT_PROGRAM) pwd
test
:
$(TIMEOUT_PROGRAM)
$(PYTHON)
$(RUNTESTS)
$(RUNTEST_OPTS)
\
$(
patsubst
%,
--only
=
%,
$(TEST)
)
\
$(
patsubst
%,
--only
=
%,
$(TESTS)
)
\
...
...
@@ -183,3 +139,4 @@ accept:
fast
:
$(MAKE)
fast
=
YES
testsuite/mk/wordsize.mk.in
deleted
100644 → 0
View file @
e6fc6a9c
#include "../../includes/MachDeps.h"
WORDSIZE = WORD_SIZE_IN_BITS
testsuite/tests/ghc-regress/Makefile
View file @
2117cc22
...
...
@@ -4,14 +4,11 @@ include $(TOP)/mk/test.mk
# 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.
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
# XXX Do this better?
# 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
%,
$(TOP)
/
../
libraries/%/tests,
$(LIBRARIES)
))
# Add tests from packages
RUNTEST_OPTS
+=
$(
patsubst
%,
--rootdir
=
%,
$(LIBRARY_TEST_PATHS)
)
testsuite/timeout/Makefile
View file @
2117cc22
TOP
=
..
/..
TOP
=
..
include
$(TOP)/mk/boilerplate.mk
include
$(TOP)/mk/cabal-flags.mk
TIMEOUT_PROGRAM
=
install-inplace/bin/timeout
$(exeext)
ifeq
"$(fi
ndstring
thr,$(GhcRTSWays))" ""
ifeq
"$(fi
lter
thr,
$(GhcRTSWays))" ""
$(TIMEOUT_PROGRAM)
:
timeout.py
$(MKDIRHIER)
`
dirname
$@
`
rm
-rf
install-inplace
mkdir
install-inplace
mkdir
install-inplace/bin
cp
$<
$@
chmod
+x
$@
else
$(TIMEOUT_PROGRAM)
:
timeout.hs
$(CABAL)
configure
$(USE_STAGE1_CONFIGURE_FLAGS)
\
$(INPLACE_DIRS_CONFIGURE_FLAGS)
\
$(COMMON_CONFIGURE_FLAGS)
\
--ghc-option
=
-threaded
$(CABAL)
build
$(CABAL)
install
rm
-rf
install-inplace
$(TEST_HC)
--make
Setup
./Setup configure
--with-compiler
=
$(TEST_HC)
--with-hc-pkg
=
$(GHC_PKG)
\
--ghc-option
=
-threaded
--prefix
=
$(
abspath
install-inplace
)
./Setup
build
./Setup
install
endif
boot all
::
calibrate.out $(TIMEOUT_PROGRAM)
...
...
testsuite/timeout/Setup.hs
0 → 100644
View file @
2117cc22
module
Main
(
main
)
where
import
Distribution.Simple
main
::
IO
()
main
=
defaultMain
testsuite/timeout/ghc.mk
deleted
100644 → 0
View file @
e6fc6a9c
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
testsuite/utils/Makefile
deleted
100644 → 0
View file @
e6fc6a9c
TOP
=
..
include
$(TOP)/mk/boilerplate.mk
HC
=
$(GHC_INPLACE)
all
::
$(HC)
--make
pwd
clean
::
rm
-f
*
.o
rm
-f
*
.hi
rm
-f
pwd
include
$(TOP)/mk/target.mk
testsuite/utils/pwd.hs
deleted
100644 → 0
View file @
e6fc6a9c
module
Main
where
import
System.Directory
import
System.Environment
main
::
IO
()
main
=
do
args
<-
getArgs
let
escape
=
case
args
of
[
"quadruple-backslash"
]
->
escape_quadruple_backslash
[
"forwardslash"
]
->
escape_forwardslash
_
->
error
(
"pwd: Bad args: "
++
show
args
)
d
<-
getCurrentDirectory
putStr
$
concatMap
escape
d
-- In prog006 we have to escape \ twice, once to get through sed and
-- again to get through parsing pkg.conf
escape_quadruple_backslash
::
Char
->
String
escape_quadruple_backslash
'
\\
'
=
"
\\\\\\\\
"
escape_quadruple_backslash
c
=
[
c
]
-- Normally we can get away with just replacing backslashes with forwardslashes
escape_forwardslash
::
Char
->
String
escape_forwardslash
'
\\
'
=
"/"
escape_forwardslash
c
=
[
c
]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment