blob: bd43578a5540e15829027b6afad6748c9edf301b (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#!/bin/sh
set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'
msgtest 'Check if installed dpkg supports' 'noawait trigger'
if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then
msgpass
else
msgskip 'dpkg version too old'
exit 0
fi
configdpkgnoopchroot
buildtriggerpackages() {
local TYPE="$1"
setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE"
BUILDDIR="incoming/triggerable-${TYPE}-1.0"
cat >"${BUILDDIR}/debian/postinst" <<EOF
#!/bin/sh
if [ "\$1" = 'triggered' ]; then
ls -l /proc/self/fd/
fi
EOF
echo "$TYPE /usr/share/doc" > "${BUILDDIR}/debian/triggers"
buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
rm -rf "$BUILDDIR"
buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable'
}
#buildtriggerpackages 'interest'
buildtriggerpackages 'interest-noawait'
buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable'
setupaptarchive
runtests() {
local TYPE="$1"
msgmsg 'Working with trigger type' "$TYPE"
testsuccess aptget install triggerable-$TYPE -y
cp rootdir/tmp/testsuccess.output terminal.output
testsuccess grep '^REWRITE ' terminal.output
testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
testsuccess aptget install trigdepends-$TYPE -y --reinstall
cp rootdir/tmp/testsuccess.output terminal.output
testsuccess grep '^REWRITE ' terminal.output
testsuccess grep ' root root ' terminal.output
testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
testsuccess aptget install trigstuff -y
cp rootdir/tmp/testsuccess.output terminal.output
testsuccess grep '^REWRITE ' terminal.output
testsuccess grep ' root root ' terminal.output
testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff
testsuccess aptget purge trigstuff -y
cp rootdir/tmp/testsuccess.output terminal.output
testsuccess grep '^REWRITE ' terminal.output
testsuccess grep ' root root ' terminal.output
testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
testdpkgnotinstalled trigstuff
testsuccess aptget purge trigdepends-$TYPE -y
cp rootdir/tmp/testsuccess.output terminal.output
testfailure grep '^REWRITE ' terminal.output
testfailure grep ' root root ' terminal.output
testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
}
#runtests 'interest'
runtests 'interest-noawait'
|