summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-769609-triggers-still-pending-after-run
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:00:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:00:48 +0000
commit851b6a097165af4d51c0db01b5e05256e5006896 (patch)
tree5f7c388ec894a7806c49a99f3bdb605d0b299a7c /test/integration/test-bug-769609-triggers-still-pending-after-run
parentInitial commit. (diff)
downloadapt-851b6a097165af4d51c0db01b5e05256e5006896.tar.xz
apt-851b6a097165af4d51c0db01b5e05256e5006896.zip
Adding upstream version 2.6.1.upstream/2.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-bug-769609-triggers-still-pending-after-run')
-rwxr-xr-xtest/integration/test-bug-769609-triggers-still-pending-after-run75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run
new file mode 100755
index 0000000..ce2c193
--- /dev/null
+++ b/test/integration/test-bug-769609-triggers-still-pending-after-run
@@ -0,0 +1,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 --compare-versions "$(dpkg_version)" 'ge' '1.16.1'; 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
+ echo "TRIGGER IS RUNNING"
+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 'TRIGGER IS RUNNING' 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 'TRIGGER IS RUNNING' 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 'TRIGGER IS RUNNING' 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 'TRIGGER IS RUNNING' terminal.output
+ testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
+}
+#runtests 'interest'
+runtests 'interest-noawait'