Procházet zdrojové kódy

* test/integration/framework:
- continue after test failure but preserve exit status

Michael Vogt před 13 roky
rodič
revize
8c1dd12cb5
2 změnil soubory, kde provedl 12 přidání a 2 odebrání
  1. 4 0
      debian/changelog
  2. 8 2
      test/integration/framework

+ 4 - 0
debian/changelog

@@ -3,6 +3,10 @@ apt (0.9.7.8~exp3) UNRELEASEDexperimental; urgency=low
   [ Niels Thykier ]
   * test/libapt/assert.h, test/libapt/run-tests:
     - exit with status 1 on test failure
+  
+  [ Daniel Hartwig ]
+  * test/integration/framework:
+    - continue after test failure but preserve exit status
 
  -- Michael Vogt <mvo@debian.org>  Sun, 17 Mar 2013 19:46:23 +0100
 

+ 8 - 2
test/integration/framework

@@ -1,5 +1,7 @@
 #!/bin/sh -- # no runable script, just for vi
 
+TESTFAILURES="no"
+
 # we all like colorful messages
 if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \
    expr match "$(readlink -f /proc/$$/fd/2)" '/dev/pts/[0-9]\+' > /dev/null; then
@@ -36,7 +38,7 @@ msgtest() {
 }
 msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; }
 msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
-msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; }
+msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; TESTFAILURES="yes"; }
 
 # enable / disable Debugging
 MSGLEVEL=${MSGLEVEL:-3}
@@ -113,9 +115,13 @@ gdb() {
 	APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1
 }
 
+exitwithstatus() {
+	[ "$TESTFAILURES" = "yes" ] && exit 1 || exit 0;
+}
+
 addtrap() {
 	CURRENTTRAP="$CURRENTTRAP $1"
-	trap "$CURRENTTRAP exit;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+	trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
 }
 
 setupenvironment() {