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 /testsuite/timeout | |
parent | 6ef11e543fee153cfc261bc3fe444656e03e0a15 (diff) | |
download | haskell-c45c86f97ee2f2aa759f7dfab86257b21fdbbb88.tar.gz |
Calibrate the testsuite timeout if a value of -1 is given
Diffstat (limited to 'testsuite/timeout')
-rw-r--r-- | testsuite/timeout/Calibrate.hs | 7 | ||||
-rw-r--r-- | testsuite/timeout/Makefile | 8 | ||||
-rw-r--r-- | testsuite/timeout/calibrate | 18 |
3 files changed, 33 insertions, 0 deletions
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]))) + |