]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-769609-triggers-still-pending-after-run
correct cross & disappear progress detection
[apt.git] / test / integration / test-bug-769609-triggers-still-pending-after-run
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6
7 setupenvironment
8 configarchitecture 'amd64'
9
10 msgtest 'Check if installed dpkg supports' 'noawait trigger'
11 if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.16.1'; then
12 msgpass
13 else
14 msgskip 'dpkg version too old'
15 exit 0
16 fi
17 configdpkgnoopchroot
18
19 buildtriggerpackages() {
20 local TYPE="$1"
21 setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE"
22 BUILDDIR="incoming/triggerable-${TYPE}-1.0"
23 cat >"${BUILDDIR}/debian/postinst" <<EOF
24 #!/bin/sh
25 if [ "\$1" = 'triggered' ]; then
26 echo "TRIGGER IS RUNNING"
27 fi
28 EOF
29 echo "$TYPE /usr/share/doc" > "${BUILDDIR}/debian/triggers"
30 buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
31 rm -rf "$BUILDDIR"
32 buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable'
33 }
34
35 #buildtriggerpackages 'interest'
36 buildtriggerpackages 'interest-noawait'
37 buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable'
38
39 setupaptarchive
40
41 runtests() {
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 'TRIGGER IS RUNNING' 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 'TRIGGER IS RUNNING' 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 'TRIGGER IS RUNNING' 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 'TRIGGER IS RUNNING' terminal.output
72 testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
73 }
74 #runtests 'interest'
75 runtests 'interest-noawait'