]> git.saurik.com Git - apt.git/commitdiff
ensure that testcases exiting because of set -e aren't successful
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 12 Aug 2013 13:51:42 +0000 (15:51 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 12 Aug 2013 16:01:37 +0000 (18:01 +0200)
Git-Dch: Ignore

test/integration/framework

index 005e31bd3a10810057cf1483b92788d0b10248a8..72c899e325522449a1fe05e63a6df3e8669ce47e 100644 (file)
@@ -131,13 +131,23 @@ exitwithstatus() {
         exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
 }
 
+shellsetedetector() {
+       local exit_status=$?
+       if [ "$exit_status" != '0' ]; then
+               echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
+               if [ "$EXIT_CODE" = '0' ]; then
+                       EXIT_CODE="$exit_status"
+               fi
+       fi
+}
+
 addtrap() {
        if [ "$1" = 'prefix' ]; then
                CURRENTTRAP="$2 $CURRENTTRAP"
        else
                CURRENTTRAP="$CURRENTTRAP $1"
        fi
-       trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+       trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
 }
 
 setupenvironment() {