* runtest.exp: Use the traditional exit codes when runtest is
authorBen Elliston <bje@gnu.org>
Mon, 15 Feb 2016 02:52:36 +0000 (13:52 +1100)
committerBen Elliston <bje@gnu.org>
Mon, 15 Feb 2016 02:52:36 +0000 (13:52 +1100)
interrupted. This makes it possible to tell if runtest ran to
completion or not. Suggested by Michael Chastain.

ChangeLog
runtest.exp

index abccd98..9f76d2f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-02-15  Ben Elliston  <bje@gnu.org>
 
+       * runtest.exp: Use the traditional exit codes when runtest is
+       interrupted. This makes it possible to tell if runtest ran to
+       completion or not. Suggested by Michael Chastain.
+
+2016-02-15  Ben Elliston  <bje@gnu.org>
+
        * lib/framework.exp (cleanup): Remove do-nothing proc.
        (log_and_exit): Remove call to cleanup.
        * doc/ref.xml: Remove documentation for cleanup.
index 58a016b..59c4591 100644 (file)
@@ -26,13 +26,12 @@ if {![info exists argv0]} {
     exit 1
 }
 
-#
 # trap some signals so we know whats happening. These definitions are only
 # temporary until we read in the library stuff
 #
-trap { send_user "\nterminated\n";             exit 1 } SIGTERM
-trap { send_user "\ninterrupted by user\n";    exit 1 } SIGINT
-trap { send_user "\nsigquit\n";                exit 1 } SIGQUIT
+trap { send_user "\ninterrupted by user\n"; exit 130 } SIGINT
+trap { send_user "\nquit\n";                exit 131 } SIGQUIT
+trap { send_user "\nterminated\n";          exit 143 } SIGTERM
 
 #
 # Initialize a few global variables used by all tests.
@@ -1511,17 +1510,17 @@ proc runtest { test_file_name } {
     }
 }
 
-#
 # Trap some signals so we know what's happening.  These replace the previous
 # ones because we've now loaded the library stuff.
 #
 if {![exp_debug]} {
-    foreach sig "{SIGTERM {terminated}} \
-            {SIGINT  {interrupted by user}} \
-            {SIGQUIT {interrupted by user}}" {
+    foreach sig {{SIGINT {interrupted by user} 130} \
+                    {SIGQUIT {interrupted by user} 131} \
+                    {SIGTERM {terminated} 143}} {
        set signal [lindex $sig 0]
        set str [lindex $sig 1]
-       trap "send_error \"got a \[trap -name\] signal, $str \\n\"; log_and_exit;" $signal
+       set code [lindex $sig 2]
+       trap "send_error \"got a \[trap -name\] signal, $str \\n\"; set exit_status $code; log_and_exit;" $signal
        verbose "setting trap for $signal to $str" 1
     }
     unset signal str sig