summaryrefslogtreecommitdiff
path: root/test/integration/test-no-fds-leaked-to-maintainer-scripts
blob: 6ed1200906cf62c7598a55daad3c19b84e563444 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment
configarchitecture 'native'
configdpkgnoopchroot

setupsimplenativepackage "fdleaks" 'native' '1.0' 'unstable'
BUILDDIR="incoming/fdleaks-1.0"
for script in 'preinst' 'postinst' 'prerm' 'postrm'; do
	echo '#!/bin/sh
ls -l /proc/self/fd/' > ${BUILDDIR}/debian/$script
done
buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
rm -rf "$BUILDDIR"

setupaptarchive

testsuccess aptget install -y fdleaks
msgtest 'Check if fds were not' 'leaked'
if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then
	msgpass
else
	echo
	cat rootdir/tmp/testsuccess.output
	msgfail
fi

testsuccess aptget purge -y fdleaks
msgtest 'Check if fds were not' 'leaked'
if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then
	msgpass
else
	echo
	cat rootdir/tmp/testsuccess.output
	msgfail
fi