]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/commitdiff
wvtest/sh: Do not exit shell script unless $WVTEST_DIE_FAST is set
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 24 Feb 2011 11:36:14 +0000 (12:36 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 24 Feb 2011 11:36:14 +0000 (12:36 +0100)
If the shell script performs setup and cleanup for the test, it is
important to cleanup even when the test fails. So by default, we do not
exit, but only return the exit code of failed command.

src/wvtest.sh

index 30574cbe4ef2b9601c1cf0f0a67ab01fddb5c2cc..5f4c665199490cb21c8cd2b47537b58cf131a74c 100755 (executable)
@@ -40,7 +40,11 @@ _wvcheck()
        fi
        echo "! $WVCALLER_FILE:$WVCALLER_LINE  $TEXT  $OK" >&2
        if [ "$CODE" -ne 0 ]; then
-               exit $CODE
+               if [ "$WVTEST_DIE_FAST" ]; then
+                       exit $CODE
+               else
+                       return $CODE
+               fi
        else
                return 0
        fi