[commit: ghc] master: testsuite: add signal_exit_code function to the driver (2cca0c0)

git at git.haskell.org git at git.haskell.org
Thu Aug 7 20:01:10 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2cca0c065c2ef41f9e82409e85bc80f27ce2ba02/ghc

>---------------------------------------------------------------

commit 2cca0c065c2ef41f9e82409e85bc80f27ce2ba02
Author: Karel Gardas <karel.gardas at centrum.cz>
Date:   Thu Aug 7 22:00:25 2014 +0200

    testsuite: add signal_exit_code function to the driver
    
    Summary:
    New function signal_exit_code hides differences between target platforms
    handling of fatal error signals and the applications' exit codes. E.g.
    on Linux the application exit code which receives fatal error signal
    is encoded as 128 + signal value. On the other hand on Solaris
    the application exit code is signal value alone.
    
    Test Plan: validated on Linux and tested on Solaris
    
    Reviewers: austin, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: phaskell, simonmar, relrod, ezyang, carter
    
    Differential Revision: https://phabricator.haskell.org/D122


>---------------------------------------------------------------

2cca0c065c2ef41f9e82409e85bc80f27ce2ba02
 testsuite/driver/testlib.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 126c8e4..9a6951b 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -232,6 +232,17 @@ def exit_code( val ):
 def _exit_code( name, opts, v ):
     opts.exit_code = v
 
+def signal_exit_code( val ):
+    if opsys('solaris2'):
+        return exit_code( val );
+    else:
+        # When application running on Linux receives fatal error
+        # signal, then its exit code is encoded as 128 + signal
+        # value. See http://www.tldp.org/LDP/abs/html/exitcodes.html
+        # I assume that Mac OS X behaves in the same way at least Mac
+        # OS X builder behavior suggests this.
+        return exit_code( val+128 );
+
 # -----
 
 def timeout_multiplier( val ):



More information about the ghc-commits mailing list