diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2013-05-28 18:08:32 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2013-06-09 15:12:32 +0200 |
commit | 8437b7d4a699c8a0bfa6c2c2bff66ffff2e36a22 (patch) | |
tree | db7ba30c9b2db7ee75993af2c08a8c193d41606c /test/integration | |
parent | f97bb5237489134cb971ce38b93c5d6220341ea8 (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')
-rw-r--r-- | test/integration/framework | 9 | ||||
-rwxr-xr-x | test/integration/test-apt-cdrom | 2 |
2 files changed, 7 insertions, 4 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 diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index f1c4fd9d3..3394aa505 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -24,7 +24,7 @@ cat Translation-de | xz --format=lzma > Translation-de.lzma cat Translation-de | xz > Translation-de.xz rm Translation-en Translation-de cd - > /dev/null -addtrap "chmod -R +w $PWD/rootdir/media/cdrom/dists/;" +addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;" chmod -R -w rootdir/media/cdrom/dists aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 |