]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-no-fds-leaked-to-maintainer-scripts
correct architecture detection for 'rc' packages for purge
[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 'amd64' 'i386'
9configdpkgnoopchroot
10
11setupsimplenativepackage "fdleaks" 'all' '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
20PKGNAME='fdleaks:all'
21if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null; then
22 PKGNAME='fdleaks'
23fi
24
25setupaptarchive
26
27rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
28testsuccess aptget install -y fdleaks -qq < /dev/null
29msgtest 'Check if fds were not' 'leaked'
30if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then
31 msgpass
32else
33 echo
34 cat rootdir/tmp/testsuccess.output
35 msgfail
36fi
37
38cp rootdir/tmp/testsuccess.output terminal.output
39tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log
40testfileequal 'terminal.log' "$(cat terminal.output)"
41
42testequal "startup archives unpack
43install $PKGNAME <none> 1.0
44status half-installed $PKGNAME 1.0
45status unpacked $PKGNAME 1.0
46status unpacked $PKGNAME 1.0
47startup packages configure
48configure $PKGNAME 1.0 <none>
49status unpacked $PKGNAME 1.0
50status half-configured $PKGNAME 1.0
51status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log
52
53rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
54testsuccess aptget purge -y fdleaks -qq
55msgtest 'Check if fds were not' 'leaked'
56if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then
57 msgpass
58else
59 echo
60 cat rootdir/tmp/testsuccess.output
61 msgfail
62fi
63cp rootdir/tmp/testsuccess.output terminal.output
64tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log
65testfileequal 'terminal.log' "$(cat terminal.output)"
66
67testequal "startup packages purge
68status installed $PKGNAME 1.0
69remove $PKGNAME 1.0 <none>
70status half-configured $PKGNAME 1.0
71status half-installed $PKGNAME 1.0
72status config-files $PKGNAME 1.0
73purge $PKGNAME 1.0 <none>
74status config-files $PKGNAME 1.0
75status config-files $PKGNAME 1.0
76status config-files $PKGNAME 1.0
77status config-files $PKGNAME 1.0
78status config-files $PKGNAME 1.0
79status not-installed $PKGNAME <none>" cut -f 3- -d' ' rootdir/var/log/dpkg.log