From: Frédéric Moulins Date: Tue, 26 Aug 2008 10:28:00 +0000 (+0200) Subject: Check for segfault and illegal instruction when expecting an error X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=12c5b22102873e303e540f886489831461d54ea9;p=uci.git Check for segfault and illegal instruction when expecting an error When an error is expected, fail the test when return code is : * 139: segmentation fault * 132: illegal instruction --- diff --git a/test/tests.sh b/test/tests.sh index ae064f1..15a4744 100644 --- a/test/tests.sh +++ b/test/tests.sh @@ -40,10 +40,21 @@ assertSameFile() { echo "----" } } +assertNotSegFault() +{ + [ $1 -eq 139 ] && fail "Returned with 139: segmentation fault (SIGSEGV)!!!" +} +assertNotIllegal() +{ + [ $1 -eq 132 ] && fail "Returned with 132: Illegal instruction (SIGILL)!!!" +} assertFailWithNoReturn() { local test="$1" value=$( $test ) - assertFalse "'$test' does not fail" $? + rv=$? + assertFalse "'$test' does not fail" $rv + assertNotSegFault $rv + assertNotIllegal $rv assertNull "'$test' returns '$value'" "$value" } EOF