summaryrefslogtreecommitdiff
path: root/test/integration/framework
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-05-28 18:08:32 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-06-09 15:12:32 +0200
commit8437b7d4a699c8a0bfa6c2c2bff66ffff2e36a22 (patch)
treedb7ba30c9b2db7ee75993af2c08a8c193d41606c /test/integration/framework
parentf97bb5237489134cb971ce38b93c5d6220341ea8 (diff)
tests: trap-adding can be post- as well as prefix
For testcases it might sometimes be handy to add trap-actions before the general cleanup, e.g. if it has set directories read- only which rm doesn't want to remove even with --force applied (its fine with files though) Git-Dch: Ignore
Diffstat (limited to 'test/integration/framework')
-rw-r--r--test/integration/framework9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/integration/framework b/test/integration/framework
index e3e868d45..7c2aed592 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -125,7 +125,11 @@ exitwithstatus() {
}
addtrap() {
- CURRENTTRAP="$CURRENTTRAP $1"
+ 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
}
@@ -135,8 +139,7 @@ setupenvironment() {
msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
BUILDDIRECTORY="${TESTDIRECTORY}/../../build/bin"
test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
- local OLDWORKINGDIRECTORY=$(pwd)
- addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY; cd $OLDWORKINGDIRECTORY;"
+ addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;"
cd $TMPWORKINGDIRECTORY
mkdir rootdir aptarchive keys
cd rootdir