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