summaryrefslogtreecommitdiffstats
path: root/tests/t-triggers-halt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:35:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:35:28 +0000
commitea314d2f45c40a006c0104157013ab4b857f665f (patch)
tree3ef2971cb3675c318b8d9effd987854ad3f6d3e8 /tests/t-triggers-halt
parentInitial commit. (diff)
downloaddpkg-ea314d2f45c40a006c0104157013ab4b857f665f.tar.xz
dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.zip
Adding upstream version 1.22.4.upstream/1.22.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/t-triggers-halt/Makefile26
-rw-r--r--tests/t-triggers-halt/pkg-depends/DEBIAN/control8
-rw-r--r--tests/t-triggers-halt/pkg-files/DEBIAN/control7
-rw-r--r--tests/t-triggers-halt/pkg-files/test/trigger/test-file1
-rw-r--r--tests/t-triggers-halt/pkg-remove/DEBIAN/control7
-rw-r--r--tests/t-triggers-halt/pkg-trigger/DEBIAN/control8
-rwxr-xr-xtests/t-triggers-halt/pkg-trigger/DEBIAN/postinst23
-rw-r--r--tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers1
8 files changed, 81 insertions, 0 deletions
diff --git a/tests/t-triggers-halt/Makefile b/tests/t-triggers-halt/Makefile
new file mode 100644
index 0000000..0ce5c0f
--- /dev/null
+++ b/tests/t-triggers-halt/Makefile
@@ -0,0 +1,26 @@
+TESTS_DEB := pkg-files pkg-depends pkg-remove pkg-trigger
+
+include ../Test.mk
+
+test-case:
+ # This is what apt is doing currently. :(
+ $(DPKG_INSTALL) pkg-files.deb
+ $(DPKG_INSTALL) pkg-depends.deb
+ $(DPKG_INSTALL) pkg-remove.deb
+ $(DPKG_INSTALL) pkg-trigger.deb
+ $(DPKG_REMOVE) --force-depends pkg-remove
+ $(DPKG_INSTALL) pkg-files.deb
+ $(DPKG_UNPACK) pkg-depends.deb
+
+ $(DPKG) -s pkg-trigger pkg-files pkg-depends
+
+ # Make sure everything is left in the expected state.
+ $(call pkg_status_is,pkg-depends,install ok unpacked)
+ $(call pkg_status_is,pkg-files,install ok triggers-awaited)
+ $(call pkg_status_is,pkg-trigger,install ok triggers-pending)
+
+ # Should fail due to unsatisfied dependencies.
+ ! $(DPKG_CONFIGURE) pkg-trigger pkg-depends
+
+test-clean:
+ -$(DPKG_PURGE) pkg-trigger pkg-depends pkg-files
diff --git a/tests/t-triggers-halt/pkg-depends/DEBIAN/control b/tests/t-triggers-halt/pkg-depends/DEBIAN/control
new file mode 100644
index 0000000..aadf8be
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-depends/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-depends
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Depends: pkg-files
+Description: test package - package to be configured
diff --git a/tests/t-triggers-halt/pkg-files/DEBIAN/control b/tests/t-triggers-halt/pkg-files/DEBIAN/control
new file mode 100644
index 0000000..92fa468
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-files/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-files
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - provides a file under /test/trigger/
diff --git a/tests/t-triggers-halt/pkg-files/test/trigger/test-file b/tests/t-triggers-halt/pkg-files/test/trigger/test-file
new file mode 100644
index 0000000..fb67027
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-files/test/trigger/test-file
@@ -0,0 +1 @@
+sample file
diff --git a/tests/t-triggers-halt/pkg-remove/DEBIAN/control b/tests/t-triggers-halt/pkg-remove/DEBIAN/control
new file mode 100644
index 0000000..59c8876
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-remove/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-remove
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package to be removed
diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/control b/tests/t-triggers-halt/pkg-trigger/DEBIAN/control
new file mode 100644
index 0000000..05a4d31
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-trigger
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Depends: pkg-remove, pkg-depends
+Description: test package - interested in files on /test/trigger/
diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst b/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst
new file mode 100755
index 0000000..72b74a1
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ triggered)
+ pkg_status=`dpkg-query -f '${Status}' -W pkg-depends`
+ if [ "$pkg_status" = "install ok installed" ]; then
+ echo "Pass: pkg-depends is installed"
+ else
+ echo "Fail: pkg-depends is not installed ($pkg_status)"
+ exit 1
+ fi
+ pkg_status=`dpkg-query -f '${Status}' -W pkg-nonexistent`
+ if [ "$pkg_status" = "install ok installed" ]; then
+ echo "Pass: pkg-nonexistent is installed"
+ else
+ echo "Fail: pkg-nonexistent is not installed ($pkg_status)"
+ exit 1
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers b/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers
new file mode 100644
index 0000000..3b047af
--- /dev/null
+++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers
@@ -0,0 +1 @@
+interest /test/trigger