diff options
author | Frédéric Moulins <ffrrrr@gmail.com> | 2008-08-26 12:28:00 +0200 |
---|---|---|
committer | Felix <nbd@openwrt.org> | 2008-08-26 12:31:34 +0200 |
commit | 12c5b22102873e303e540f886489831461d54ea9 (patch) | |
tree | 46394a8cf6fea85cf0e2aba1a7ce3fac515ee08c | |
parent | 8500c9b01699a94c0516ee5cbc10e8c0fb7b0408 (diff) | |
download | uci-12c5b22102873e303e540f886489831461d54ea9.tar.gz |
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
-rw-r--r-- | test/tests.sh | 13 |
1 files changed, 12 insertions, 1 deletions
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 |