]> git.saurik.com Git - apt.git/commitdiff
test: Avoid use of /proc/self/fd
authorJulian Andres Klode <jak@debian.org>
Tue, 23 Aug 2016 22:25:26 +0000 (00:25 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 20:17:55 +0000 (22:17 +0200)
Use /dev/fd in test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch,
skip test-no-fds-leaked-to-maintainer-scripts (it is not guaranteed
that /dev/fd contains all file descriptors), and avoid the unneeded
use of /proc/fd in another test case.

Gbp-Dch: ignore

test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
test/integration/test-bug-769609-triggers-still-pending-after-run
test/integration/test-no-fds-leaked-to-maintainer-scripts

index d9fd3d30dfaa54f6b5b60233bed798f004c5e276..bf93367c99b9c1d32e3d6083fd7d76b0647d1e4f 100755 (executable)
@@ -32,7 +32,7 @@ if [ -n \"${2}\" ]; then
        FD=\$APT_HOOK_INFO_FD
        if [ "\$FD" != \"${2}\" ]; then echo \"ERROR: Information is not on requested FD: \$FD != ${2}\" >> ${hook}-v${1}.list; fi
 fi
-while read </proc/\$\$/fd/\$FD line; do
+while read </dev/fd/\$FD line; do
        if echo \"\$line\" | grep -Fq '**'; then
                echo \"\$line\"
        fi
index bd43578a5540e15829027b6afad6748c9edf301b..b44ebf74f0b9aa1856e3f36b9328ba5a1f8b684d 100755 (executable)
@@ -23,7 +23,7 @@ buildtriggerpackages() {
        cat >"${BUILDDIR}/debian/postinst" <<EOF
 #!/bin/sh
 if [ "\$1" = 'triggered' ]; then
-       ls -l /proc/self/fd/
+       echo "TRIGGER IS RUNNING"
 fi
 EOF
        echo "$TYPE /usr/share/doc" > "${BUILDDIR}/debian/triggers"
@@ -49,26 +49,26 @@ runtests() {
        testsuccess aptget install trigdepends-$TYPE -y --reinstall
        cp rootdir/tmp/testsuccess.output terminal.output
        testsuccess grep '^REWRITE ' terminal.output
-       testsuccess grep ' root root ' terminal.output
+       testsuccess grep 'TRIGGER IS RUNNING' terminal.output
        testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
 
        testsuccess aptget install trigstuff -y
        cp rootdir/tmp/testsuccess.output terminal.output
        testsuccess grep '^REWRITE ' terminal.output
-       testsuccess grep ' root root ' terminal.output
+       testsuccess grep 'TRIGGER IS RUNNING' terminal.output
        testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff
 
        testsuccess aptget purge trigstuff -y
        cp rootdir/tmp/testsuccess.output terminal.output
        testsuccess grep '^REWRITE ' terminal.output
-       testsuccess grep ' root root ' terminal.output
+       testsuccess grep 'TRIGGER IS RUNNING' terminal.output
        testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
        testdpkgnotinstalled trigstuff
 
        testsuccess aptget purge trigdepends-$TYPE -y
        cp rootdir/tmp/testsuccess.output terminal.output
        testfailure grep '^REWRITE ' terminal.output
-       testfailure grep ' root root ' terminal.output
+       testfailure grep 'TRIGGER IS RUNNING' terminal.output
        testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
 }
 #runtests 'interest'
index baf85e3112e2eef383fc2e72d972e7594b83c44f..ca93f78b4f7e9e707d70234a87e4dc770d999b53 100755 (executable)
@@ -8,6 +8,11 @@ setupenvironment
 configarchitecture 'amd64' 'i386'
 configdpkgnoopchroot
 
+if [ ! -e /proc/self/fd ]; then
+       msgskip "needs /proc/self/fd"
+    exit 0
+fi
+
 setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable'
 BUILDDIR="incoming/fdleaks-1.0"
 for script in 'preinst' 'postinst' 'prerm' 'postrm'; do