]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-bug-254770-segfault-if-cache-not-buildable
Merge pull request julian-klode/apt#3 from adrian17/master
[apt.git] / test / integration / test-bug-254770-segfault-if-cache-not-buildable
index 59102ddc9d1bece7e124e4facd0ad3046f7e9c5e..6f6e1abc08b19033f15294bf2c721caaa4b457e7 100755 (executable)
@@ -1,19 +1,27 @@
 #!/bin/sh
 set -e
 
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+msgtest 'Test run as' 'non-root'
+if [ "$(id -u)" = '0' ]; then
+       msgskip 'root has by definition no problems accessing files'
+       exit 0
+else
+       msgpass
+fi
+
 setupenvironment
 configarchitecture "i386"
 setupaptarchive
 
-CURRENTTRAP="chmod a+x rootdir/var/lib/dpkg; $CURRENTTRAP"
-trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+addtrap 'prefix' 'chmod a+x rootdir/var/lib/dpkg;'
 chmod a-x rootdir/var/lib/dpkg
 
 testsegfault() {
        msgtest "No segfault in" "$*"
-       local TEST="$($* 2>&1 | grep -v 'E:')"
+       local TEST="$("$@" 2>&1 | grep -v 'E:')"
        if [ -z "$TEST" ]; then
                msgpass
        else