]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-769609-triggers-still-pending-after-run
eipp: add Allow-Temporary-Remove-of-Essentials
[apt.git] / test / integration / test-bug-769609-triggers-still-pending-after-run
CommitLineData
a2a75ff4
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
a2a75ff4
DK
6
7setupenvironment
8configarchitecture 'amd64'
9
10msgtest 'Check if installed dpkg supports' 'noawait trigger'
11if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then
12 msgpass
13else
14 msgskip 'dpkg version too old'
15 exit 0
16fi
17configdpkgnoopchroot
18
19buildtriggerpackages() {
20 local TYPE="$1"
21 setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE"
22 BUILDDIR="incoming/triggerable-${TYPE}-1.0"
63c71412 23 cat >"${BUILDDIR}/debian/postinst" <<EOF
a2a75ff4
DK
24#!/bin/sh
25if [ "\$1" = 'triggered' ]; then
26 ls -l /proc/self/fd/
27fi
28EOF
63c71412 29 echo "$TYPE /usr/share/doc" > "${BUILDDIR}/debian/triggers"
a2a75ff4
DK
30 buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
31 rm -rf "$BUILDDIR"
32 buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable'
33}
34
35#buildtriggerpackages 'interest'
36buildtriggerpackages 'interest-noawait'
37buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable'
38
39setupaptarchive
40
41runtests() {
42 local TYPE="$1"
43 msgmsg 'Working with trigger type' "$TYPE"
44 testsuccess aptget install triggerable-$TYPE -y
45 cp rootdir/tmp/testsuccess.output terminal.output
46 testsuccess grep '^REWRITE ' terminal.output
47 testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
48
49 testsuccess aptget install trigdepends-$TYPE -y --reinstall
50 cp rootdir/tmp/testsuccess.output terminal.output
51 testsuccess grep '^REWRITE ' terminal.output
52 testsuccess grep ' root root ' terminal.output
53 testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
54
55 testsuccess aptget install trigstuff -y
56 cp rootdir/tmp/testsuccess.output terminal.output
57 testsuccess grep '^REWRITE ' terminal.output
58 testsuccess grep ' root root ' terminal.output
59 testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff
60
61 testsuccess aptget purge trigstuff -y
62 cp rootdir/tmp/testsuccess.output terminal.output
63 testsuccess grep '^REWRITE ' terminal.output
64 testsuccess grep ' root root ' terminal.output
65 testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
66 testdpkgnotinstalled trigstuff
67
68 testsuccess aptget purge trigdepends-$TYPE -y
69 cp rootdir/tmp/testsuccess.output terminal.output
70 testfailure grep '^REWRITE ' terminal.output
71 testfailure grep ' root root ' terminal.output
72 testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
73}
74#runtests 'interest'
75runtests 'interest-noawait'