Commit e978cd66 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Merge remote-tracking branch 'origin/master' into tc-untouchables

parents 6eed6731 1175d359
......@@ -255,6 +255,9 @@ class TestOptions:
# Should we redirect stdout and stderr to a single file?
self.combined_output = False
# How should the timeout be adjusted on this test?
self.timeout_multiplier = 1.0
# The default set of options
global default_testopts
default_testopts = TestOptions()
......
......@@ -14,6 +14,7 @@ import traceback
import copy
import glob
import types
import math
have_subprocess = False
try:
......@@ -218,6 +219,14 @@ def _exit_code( opts, v ):
# -----
def timeout_multiplier( val ):
return lambda opts, v=val: _timeout_multiplier(opts, v)
def _timeout_multiplier( opts, v ):
opts.timeout_multiplier = v
# -----
def extra_run_opts( val ):
return lambda opts, v=val: _extra_run_opts(opts, v);
......@@ -1176,13 +1185,13 @@ def simple_run( name, way, prog, args ):
+ stdin_comes_from \
+ redirection
if getTestOpts().cmd_wrapper != None:
cmd = getTestOpts().cmd_wrapper(cmd);
if opts.cmd_wrapper != None:
cmd = opts.cmd_wrapper(cmd);
cmd = 'cd ' + getTestOpts().testdir + ' && ' + cmd
cmd = 'cd ' + opts.testdir + ' && ' + cmd
# run the command
result = runCmdFor(name, cmd)
result = runCmdFor(name, cmd, timeout_multiplier=opts.timeout_multiplier)
exit_code = result >> 8
signal = result & 0xff
......@@ -1198,9 +1207,11 @@ def simple_run( name, way, prog, args ):
check_prof = my_rts_flags.find("-p") != -1
if not opts.ignore_output:
if not opts.combined_output and not check_stderr_ok(name):
bad_stderr = not opts.combined_output and not check_stderr_ok(name)
bad_stdout = not check_stdout_ok(name)
if bad_stderr:
return failBecause('bad stderr')
if not check_stdout_ok(name):
if bad_stdout:
return failBecause('bad stdout')
# exit_code > 127 probably indicates a crash, so don't try to run hp2ps.
if check_hp and (exit_code <= 127 or exit_code == 251) and not check_hp_ok(name):
......@@ -1285,7 +1296,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ):
cmd = 'cd ' + getTestOpts().testdir + " && " + cmd
result = runCmdFor(name, cmd)
result = runCmdFor(name, cmd, timeout_multiplier=getTestOpts().timeout_multiplier)
exit_code = result >> 8
signal = result & 0xff
......@@ -1712,23 +1723,24 @@ def runCmd( cmd ):
r = os.system(cmd)
return r << 8
def runCmdFor( name, cmd ):
def runCmdFor( name, cmd, timeout_multiplier=1.0 ):
if_verbose( 1, cmd )
r = 0
if config.os == 'mingw32':
# On MinGW, we will always have timeout
assert config.timeout_prog!=''
timeout = int(math.ceil(config.timeout * timeout_multiplier))
if config.timeout_prog != '':
if config.check_files_written:
fn = name + ".strace"
r = rawSystem(["strace", "-o", fn, "-fF", "-e", "creat,open,chdir,clone,vfork",
config.timeout_prog, str(config.timeout),
config.timeout_prog, str(timeout),
cmd])
addTestFilesWritten(name, fn)
rm_no_fail(fn)
else:
r = rawSystem([config.timeout_prog, str(config.timeout), cmd])
r = rawSystem([config.timeout_prog, str(timeout), cmd])
else:
r = os.system(cmd)
return r << 8
......
{-# LANGUAGE MagicHash #-}
import Control.Concurrent
import qualified Data.Vector as U
main = do
t <- forkIO (U.sum (U.enumFromTo 1 (1000000000 :: Int)) `seq` return ())
threadDelay 10
killThread t
putStrLn "Done"
{-# LANGUAGE MagicHash #-}
-- Should be compiled with -O0
import Control.Concurrent
import GHC.Conc
import GHC.Prim
import GHC.Exts
main = do
t <- forkIO (f 0 `seq` return ())
threadDelay 10
killThread t
putStrLn "Done"
-- Non-allocating let-no-escape infinite loop in fail
{-# NOINLINE f #-}
f :: Int -> Bool
f i@(I# j) = let fail :: Int# -> Bool
fail i = fail (i +# 1#)
in if (case i of
0 -> True
_ -> False) then fail j else False
......@@ -21,6 +21,10 @@ test('conc071', omit_ways(['threaded2']), compile_and_run, [''])
test('conc072', only_ways(['threaded2']), compile_and_run, [''])
test('conc073', normal, compile_and_run, [''])
# vector code must get inlined to become non-allocating
test('367', composes([reqlib('vector'), timeout_multiplier(0.001)]), compile_and_run, ['-O2 -fno-omit-yields'])
test('367_letnoescape', composes([timeout_multiplier(0.001)]), compile_and_run, ['-fno-omit-yields'])
test('1980', normal, compile_and_run, [''])
test('2910', normal, compile_and_run, [''])
test('2910a', normal, compile_and_run, [''])
......
#!/bin/bash
#!/bin/sh
#
# file T6106_preproc.sh
#
......
{-# LANGUAGE BangPatterns #-}
module Main where
import qualified Data.ByteString as S
import Data.IORef
import Control.Monad
makeBs :: Int -> S.ByteString
makeBs n = S.replicate n (fromIntegral n)
doStuff :: IORef [S.ByteString] -> Int -> IO ()
doStuff ref n = do
let !bs = makeBs n
modifyIORef ref (bs:)
{-# NOINLINE doStuff #-}
undo :: IORef [S.ByteString] -> IO ()
undo ref = do
h <- atomicModifyIORef ref (\(x:xs) -> (xs,x))
S.length h `seq` return ()
main = do
ref <- newIORef [S.empty]
let fn n = do
doStuff ref n
when (rem 5 n /= 0 ) $ undo ref
mapM_ fn (take 5000000 $ cycle [1..100])
var <- readIORef ref
print $ length var
......@@ -237,3 +237,20 @@ test('T5536',
compile_and_run,
['-O'])
test('T7257',
[if_wordsize(32,
stats_range_field('bytes allocated', 1150000000, 10)),
# expected value: 1246287228 (i386/Linux)
if_wordsize(32,
stats_range_field('peak_megabytes_allocated', 150, 5)),
# unkonwn
if_wordsize(64,
stats_range_field('bytes allocated', 1774893760, 5)),
# 2012-09-21: 1774893760 (amd64/Linux)
if_wordsize(64,
stats_range_field('peak_megabytes_allocated', 227, 5)),
# 2012-09-21: 227 (amd64/Linux)
only_ways(['normal'])
],
compile_and_run, ['-O'])
rn050.hs:10:3: Warning:
In the use of `op' (imported from Rn050_A):
Deprecated: "Use bop instead"
rn050.hs:13:7: Warning:
In the use of `op' (imported from Rn050_A):
Deprecated: "Use bop instead"
......
rn066.hs:10:3: Warning:
In the use of `op' (imported from Rn066_A):
"Is that really a good idea?"
rn066.hs:13:7: Warning:
In the use of `op' (imported from Rn066_A):
"Is that really a good idea?"
......
......@@ -158,3 +158,7 @@ test('T7040_ghci', [ only_ways(['ghci']),
cmd_prefix('$MAKE T7040_ghci_setup && '),
extra_clean(['T7040_ghci_c.o']) ],
compile_and_run, ['T7040_ghci_c.o'])
test('T7227', [ extra_run_opts('+RTS -tT7227.stat --machine-readable -RTS'),
extra_clean(['T7227.stat']) ]
, compile_and_run, [''] )
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