Commit c45c86f9 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Calibrate the testsuite timeout if a value of -1 is given

parent 6ef11e54
......@@ -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
......
......@@ -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 = []
......
......@@ -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
......
module Main (main) where
import System.IO
main = hPutStr stderr ""
......@@ -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
......
#!/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])))
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