]>
Commit | Line | Data |
---|---|---|
0c787570 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | ||
7 | setupenvironment | |
b8ef7ef4 | 8 | configarchitecture 'amd64' 'i386' |
0c787570 DK |
9 | configdpkgnoopchroot |
10 | ||
150bdc9c | 11 | setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' |
0c787570 DK |
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 | ||
b8ef7ef4 DK |
20 | PKGNAME='fdleaks:all' |
21 | if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null; then | |
22 | PKGNAME='fdleaks' | |
23 | fi | |
24 | ||
0c787570 DK |
25 | setupaptarchive |
26 | ||
150bdc9c DK |
27 | rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log |
28 | testsuccess aptget install -y fdleaks -qq < /dev/null | |
0c787570 | 29 | |
c6bc9735 DK |
30 | checkfdleak() { |
31 | msgtest 'Check if fds were not' 'leaked' | |
32 | if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = "$1" ]; then | |
33 | msgpass | |
34 | else | |
35 | echo | |
36 | cat rootdir/tmp/testsuccess.output | |
37 | msgfail | |
38 | fi | |
39 | } | |
40 | checkinstall() { | |
41 | checkfdleak 8 | |
42 | ||
43 | cp rootdir/tmp/testsuccess.output terminal.output | |
44 | tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log | |
45 | testfileequal 'terminal.log' "$(cat terminal.output)" | |
150bdc9c | 46 | |
c6bc9735 | 47 | testequal "startup archives unpack |
b8ef7ef4 DK |
48 | install $PKGNAME <none> 1.0 |
49 | status half-installed $PKGNAME 1.0 | |
50 | status unpacked $PKGNAME 1.0 | |
51 | status unpacked $PKGNAME 1.0 | |
150bdc9c | 52 | startup packages configure |
b8ef7ef4 DK |
53 | configure $PKGNAME 1.0 <none> |
54 | status unpacked $PKGNAME 1.0 | |
55 | status half-configured $PKGNAME 1.0 | |
ecb777dd DK |
56 | status installed $PKGNAME 1.0 |
57 | startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log | |
c6bc9735 DK |
58 | } |
59 | checkinstall | |
150bdc9c DK |
60 | |
61 | rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log | |
62 | testsuccess aptget purge -y fdleaks -qq | |
c6bc9735 DK |
63 | checkpurge() { |
64 | checkfdleak 12 | |
65 | ||
66 | cp rootdir/tmp/testsuccess.output terminal.output | |
67 | tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log | |
68 | testfileequal 'terminal.log' "$(cat terminal.output)" | |
150bdc9c | 69 | |
c6bc9735 | 70 | testequal "startup packages purge |
b8ef7ef4 DK |
71 | status installed $PKGNAME 1.0 |
72 | remove $PKGNAME 1.0 <none> | |
73 | status half-configured $PKGNAME 1.0 | |
74 | status half-installed $PKGNAME 1.0 | |
75 | status config-files $PKGNAME 1.0 | |
76 | purge $PKGNAME 1.0 <none> | |
77 | status config-files $PKGNAME 1.0 | |
78 | status config-files $PKGNAME 1.0 | |
79 | status config-files $PKGNAME 1.0 | |
80 | status config-files $PKGNAME 1.0 | |
81 | status config-files $PKGNAME 1.0 | |
ecb777dd DK |
82 | status not-installed $PKGNAME <none> |
83 | startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log | |
c6bc9735 DK |
84 | } |
85 | checkpurge | |
86 | ||
87 | rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log | |
88 | testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" install -y fdleaks -qq < /dev/null | |
89 | checkinstall | |
90 | ||
91 | rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log | |
92 | testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq | |
93 | checkpurge |