From 0d2d15fa796e8724ce31eefb335cd91a168a1a98 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Mon, 24 Nov 2008 17:28:39 -0500 Subject: [PATCH] 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) --- wvtestrunner.pl | 7 +++++++ 1 file changed, 7 insertions(+) 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", -- 2.39.2