]>
Commit | Line | Data |
---|---|---|
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" 'all' '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 | rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log | |
23 | testsuccess aptget install -y fdleaks -qq < /dev/null | |
24 | msgtest 'Check if fds were not' 'leaked' | |
25 | if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then | |
26 | msgpass | |
27 | else | |
28 | echo | |
29 | cat rootdir/tmp/testsuccess.output | |
30 | msgfail | |
31 | fi | |
32 | ||
33 | cp rootdir/tmp/testsuccess.output terminal.output | |
34 | tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log | |
35 | testfileequal 'terminal.log' "$(cat terminal.output)" | |
36 | ||
37 | testequal 'startup archives unpack | |
38 | install fdleaks:all <none> 1.0 | |
39 | status half-installed fdleaks:all 1.0 | |
40 | status unpacked fdleaks:all 1.0 | |
41 | status unpacked fdleaks:all 1.0 | |
42 | startup packages configure | |
43 | configure fdleaks:all 1.0 <none> | |
44 | status unpacked fdleaks:all 1.0 | |
45 | status half-configured fdleaks:all 1.0 | |
46 | status installed fdleaks:all 1.0' cut -f 3- -d' ' rootdir/var/log/dpkg.log | |
47 | ||
48 | rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log | |
49 | testsuccess aptget purge -y fdleaks -qq | |
50 | msgtest 'Check if fds were not' 'leaked' | |
51 | if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then | |
52 | msgpass | |
53 | else | |
54 | echo | |
55 | cat rootdir/tmp/testsuccess.output | |
56 | msgfail | |
57 | fi | |
58 | cp rootdir/tmp/testsuccess.output terminal.output | |
59 | tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log | |
60 | testfileequal 'terminal.log' "$(cat terminal.output)" | |
61 | ||
62 | testequal 'startup packages purge | |
63 | status installed fdleaks:all 1.0 | |
64 | remove fdleaks:all 1.0 <none> | |
65 | status half-configured fdleaks:all 1.0 | |
66 | status half-installed fdleaks:all 1.0 | |
67 | status config-files fdleaks:all 1.0 | |
68 | purge fdleaks:all 1.0 <none> | |
69 | status config-files fdleaks:all 1.0 | |
70 | status config-files fdleaks:all 1.0 | |
71 | status config-files fdleaks:all 1.0 | |
72 | status config-files fdleaks:all 1.0 | |
73 | status config-files fdleaks:all 1.0 | |
74 | status not-installed fdleaks:all <none>' cut -f 3- -d' ' rootdir/var/log/dpkg.log |