diff options
author | Ian Lynagh <igloo@earth.li> | 2007-04-05 13:33:31 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2007-04-05 13:33:31 +0000 |
commit | c45c86f97ee2f2aa759f7dfab86257b21fdbbb88 (patch) | |
tree | 8a1803ea2c321a11f1dc8aae336c491118345f97 | |
parent | 6ef11e543fee153cfc261bc3fe444656e03e0a15 (diff) | |
download | haskell-c45c86f97ee2f2aa759f7dfab86257b21fdbbb88.tar.gz |
Calibrate the testsuite timeout if a value of -1 is given
-rw-r--r-- | testsuite/driver/runtests.py | 6 | ||||
-rw-r--r-- | testsuite/driver/testglobals.py | 3 | ||||
-rw-r--r-- | testsuite/mk/test.mk | 1 | ||||
-rw-r--r-- | testsuite/timeout/Calibrate.hs | 7 | ||||
-rw-r--r-- | testsuite/timeout/Makefile | 8 | ||||
-rw-r--r-- | testsuite/timeout/calibrate | 18 |
6 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index fea1843026..77a9c1a09d 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -89,6 +89,12 @@ if config.use_threads: t.thread_pool = threading.Condition(t.lock) t.running_threads = 0 +# if timeout == -1 then we try to calculate a sensible value +if config.timeout == -1: + config.timeout = int(read_no_crs(config.top + '/timeout/calibrate.out')) + +print 'Timeout is ' + str(config.timeout) + # ----------------------------------------------------------------------------- # The main dude diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 787a5c6dc7..9873d3b9a0 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -16,6 +16,9 @@ class TestConfig: def __init__(self): + # Where the testsuite root is + self.top = '' + # Directories below which to look for test description files (foo.T) self.rootdirs = [] diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index a4395e890f..58b9cdbfdd 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -118,6 +118,7 @@ RUNTEST_OPTS += \ -e "if '$(USETHREADS)': config.use_threads=int($(USETHREADS))" \ -e config.timeout="int($(TIMEOUT)) or config.timeout" \ -e config.timeout_prog=\"$(TOP)/timeout/timeout\" \ + -e config.top=\"$(TOP)\" \ $(EXTRA_RUNTEST_OPTS) # HostPlatform_CPP should ideally be TargetPlatform_CPP, but that diff --git a/testsuite/timeout/Calibrate.hs b/testsuite/timeout/Calibrate.hs new file mode 100644 index 0000000000..77f60ecdef --- /dev/null +++ b/testsuite/timeout/Calibrate.hs @@ -0,0 +1,7 @@ + +module Main (main) where + +import System.IO + +main = hPutStr stderr "" + diff --git a/testsuite/timeout/Makefile b/testsuite/timeout/Makefile index f3424ad679..40d71e0881 100644 --- a/testsuite/timeout/Makefile +++ b/testsuite/timeout/Makefile @@ -4,6 +4,7 @@ include $(TOP)/mk/boilerplate.mk HC = $(GHC_INPLACE) MKDEPENDHS = $(GHC_INPLACE) SRC_HC_OPTS += -threaded +EXCLUDED_SRCS += Calibrate.hs ifeq "$(Windows)" "NO" SRC_HC_OPTS += -package unix @@ -11,12 +12,19 @@ endif HS_PROG = timeout +boot :: calibrate.out + ifeq "$(findstring thr,$(GhcRTSWays))" "thr" boot :: $(HS_PROG) else boot :: python-timeout endif +calibrate.out: + chmod +x calibrate + rm -f Calibrate.o Calibrate.hi Calibrate + ./calibrate "$(HC)" > $@ + python-timeout: cp timeout.py timeout chmod +x timeout diff --git a/testsuite/timeout/calibrate b/testsuite/timeout/calibrate new file mode 100644 index 0000000000..c4bdba64f8 --- /dev/null +++ b/testsuite/timeout/calibrate @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import math +import os +from os import * +from sys import * +from resource import * + +compiler = argv[1] +compiler_name = os.path.basename(compiler) + +spawnl(os.P_WAIT, compiler, + compiler_name, 'Calibrate.hs', '-o', 'Calibrate', '-O2') +spawnl(os.P_WAIT, './Calibrate', 'Calibrate') + +xs = getrusage(RUSAGE_CHILDREN); +print (300*int(math.ceil(xs[0] + xs[1]))) + |