From: Avery Pennarun Date: Mon, 24 Nov 2008 22:28:39 +0000 (-0500) Subject: wvtestrunner: catch segfaults in the subprogram. X-Git-Url: http://rtime.felk.cvut.cz/gitweb/wvtest.git/commitdiff_plain/0d2d15fa796e8724ce31eefb335cd91a168a1a98 wvtestrunner: catch segfaults in the subprogram. 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) --- diff --git a/wvtestrunner.pl b/wvtestrunner.pl index 0938b75..e210c76 100755 --- a/wvtestrunner.pl +++ b/wvtestrunner.pl @@ -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",