]> rtime.felk.cvut.cz Git - wvtest.git/commitdiff
wvtestrunner: catch segfaults in the subprogram.
authorAvery Pennarun <apenwarr@gmail.com>
Mon, 24 Nov 2008 22:28:39 +0000 (17:28 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 1 May 2009 01:15:42 +0000 (21:15 -0400)
wvtestrunner would notice if the subprogram returned a non-zero exit code,
but not if it died on a signal.  Thus, a unit test program dying on a
segfault was considered a success.  Oops!

(cherry picked from commit 9aff60fa6d55a46440a8e4d6bf343753b2bdc1ec)

wvtestrunner.pl

index 0938b753dfd1db82feb855c5886e357e6409b133..e210c76827f5f8a44430eab9fcdbff0a55fbb4dd 100755 (executable)
@@ -139,10 +139,17 @@ if ($newpid != $pid) {
 my $code = $?;
 my $ret = ($code >> 8);
 
+# return death-from-signal exits as >128.  This is what bash does if you ran
+# the program directly.
+if ($code && !$ret) { $ret = $code | 128; }
+
 if ($ret && @log) {
     print "\n" . join("\n", @log) . "\n";
 }
 
+if ($code != 0) {
+    print resultline("Program returned non-zero exit code ($ret)", "FAILED");
+}
 
 my $gtotal = $gpasses+$gfails;
 printf("\nWvTest: %d test%s, %d failure%s.\n",