]> git.saurik.com Git - apt.git/blob - test/integration/test-no-fds-leaked-to-maintainer-scripts
close leaking slave fd after setting up pty magic
[apt.git] / test / integration / test-no-fds-leaked-to-maintainer-scripts
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture 'native'
9 configdpkgnoopchroot
10
11 setupsimplenativepackage "fdleaks" 'native' '1.0' 'unstable'
12 BUILDDIR="incoming/fdleaks-1.0"
13 for script in 'preinst' 'postinst' 'prerm' 'postrm'; do
14 echo '#!/bin/sh
15 ls -l /proc/self/fd/' > ${BUILDDIR}/debian/$script
16 done
17 buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
18 rm -rf "$BUILDDIR"
19
20 setupaptarchive
21
22 testsuccess aptget install -y fdleaks
23 msgtest 'Check if fds were not' 'leaked'
24 if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then
25 msgpass
26 else
27 echo
28 cat rootdir/tmp/testsuccess.output
29 msgfail
30 fi
31
32 testsuccess aptget purge -y fdleaks
33 msgtest 'Check if fds were not' 'leaked'
34 if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then
35 msgpass
36 else
37 echo
38 cat rootdir/tmp/testsuccess.output
39 msgfail
40 fi