]>
Commit | Line | Data |
---|---|---|
a2a75ff4 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
a2a75ff4 DK |
6 | |
7 | setupenvironment | |
8 | configarchitecture 'amd64' | |
9 | ||
10 | msgtest 'Check if installed dpkg supports' 'noawait trigger' | |
03ae49ac | 11 | if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.16.1'; then |
a2a75ff4 DK |
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" | |
63c71412 | 23 | cat >"${BUILDDIR}/debian/postinst" <<EOF |
a2a75ff4 DK |
24 | #!/bin/sh |
25 | if [ "\$1" = 'triggered' ]; then | |
8683da61 | 26 | echo "TRIGGER IS RUNNING" |
a2a75ff4 DK |
27 | fi |
28 | EOF | |
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' | |
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 | |
8683da61 | 52 | testsuccess grep 'TRIGGER IS RUNNING' terminal.output |
a2a75ff4 DK |
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 | |
8683da61 | 58 | testsuccess grep 'TRIGGER IS RUNNING' terminal.output |
a2a75ff4 DK |
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 | |
8683da61 | 64 | testsuccess grep 'TRIGGER IS RUNNING' terminal.output |
a2a75ff4 DK |
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 | |
8683da61 | 71 | testfailure grep 'TRIGGER IS RUNNING' terminal.output |
a2a75ff4 DK |
72 | testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE |
73 | } | |
74 | #runtests 'interest' | |
75 | runtests 'interest-noawait' |