[commit: ghc] master: testsuite: Show killed command line on timeout (f519cb5)
git at git.haskell.org
git at git.haskell.org
Tue Jul 21 19:42:19 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f519cb551c5b17feb7dbc12d5c08ee64a64c6a92/ghc
>---------------------------------------------------------------
commit f519cb551c5b17feb7dbc12d5c08ee64a64c6a92
Author: Ben Gamari <ben at smart-cactus.org>
Date: Tue Jul 21 17:37:03 2015 +0200
testsuite: Show killed command line on timeout
>---------------------------------------------------------------
f519cb551c5b17feb7dbc12d5c08ee64a64c6a92
testsuite/timeout/timeout.hs | 8 ++++----
testsuite/timeout/timeout.py | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/testsuite/timeout/timeout.hs b/testsuite/timeout/timeout.hs
index f78baa1..3532497 100644
--- a/testsuite/timeout/timeout.hs
+++ b/testsuite/timeout/timeout.hs
@@ -33,8 +33,8 @@ main = do
_ -> die ("Can't parse " ++ show secs ++ " as a number of seconds")
_ -> die ("Bad arguments " ++ show args)
-timeoutMsg :: String
-timeoutMsg = "Timeout happened...killing process..."
+timeoutMsg :: String -> String
+timeoutMsg cmd = "Timeout happened...killing process "++cmd++"..."
run :: Int -> String -> IO ()
#if !defined(mingw32_HOST_OS)
@@ -61,7 +61,7 @@ run secs cmd = do
r <- takeMVar m
case r of
Nothing -> do
- hPutStrLn stderr timeoutMsg
+ hPutStrLn stderr (timeoutMsg cmd)
killProcess pid
exitWith (ExitFailure 99)
Just (Exited r) -> exitWith r
@@ -122,7 +122,7 @@ run secs cmd =
let millisecs = secs * 1000
rc <- waitForSingleObject handle (fromIntegral millisecs)
if rc == cWAIT_TIMEOUT
- then do hPutStrLn stderr timeoutMsg
+ then do hPutStrLn stderr (timeoutMsg cmd)
terminateJobObject job 99
exitWith (ExitFailure 99)
else alloca $ \p_exitCode ->
diff --git a/testsuite/timeout/timeout.py b/testsuite/timeout/timeout.py
index df50806..1016e2d 100644
--- a/testsuite/timeout/timeout.py
+++ b/testsuite/timeout/timeout.py
@@ -35,7 +35,8 @@ try:
else:
# parent
def handler(signum, frame):
- sys.stderr.write('Timeout happened...killing process...\n')
+ msg = 'Timeout happened...killing process %s...\n' % cmd
+ sys.stderr.write(msg)
killProcess(pid)
sys.exit(99)
old = signal.signal(signal.SIGALRM, handler)
More information about the ghc-commits
mailing list