btrfs-progs: tests: don't treat segfault as ignorable error

Some fuzzed images cause various tools to crash but the mayfail helper
would not recognize that. We don't mind if the utility failes but it
must not crash.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-10-03 17:55:49 +02:00
parent a5ac954153
commit b6bf79eb96
1 changed files with 9 additions and 3 deletions

View File

@ -48,6 +48,8 @@ run_check_stdout()
# same as run_check but does not fail the test, output is logged
run_mayfail()
{
local ret
echo "############### $@" >> $RESULTS 2>&1
if [ "$TEST_LOG" = 'tty' ]; then echo "CMD(mayfail): $@" > /dev/tty; fi
if [ "$1" = 'root_helper' ]; then
@ -55,9 +57,13 @@ run_mayfail()
else
$INSTRUMENT "$@" >> $RESULTS 2>&1
fi
if [ $? != 0 ]; then
echo "failed (ignored): $@" >> $RESULTS
return 1
ret=$?
if [ $ret != 0 ]; then
echo "failed (ignored, ret=$ret): $@" >> $RESULTS
if [ $ret == 139 ]; then
_fail "mayfail: returned code 139 (SEGFAULT), not ignored"
fi
return $ret
fi
}