summaryrefslogtreecommitdiffstats
path: root/tests/t-triggers-cycle
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/t-triggers-cycle/Makefile21
-rw-r--r--tests/t-triggers-cycle/pkg-depends/DEBIAN/control7
-rw-r--r--tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control8
-rwxr-xr-xtests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst20
-rw-r--r--tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers1
-rw-r--r--tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control8
-rwxr-xr-xtests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst20
-rw-r--r--tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers1
8 files changed, 86 insertions, 0 deletions
diff --git a/tests/t-triggers-cycle/Makefile b/tests/t-triggers-cycle/Makefile
new file mode 100644
index 0000000..b17f877
--- /dev/null
+++ b/tests/t-triggers-cycle/Makefile
@@ -0,0 +1,21 @@
+TESTS_DEB := pkg-depends pkg-trigger-a pkg-trigger-b
+
+include ../Test.mk
+
+test-case:
+ $(DPKG_INSTALL) pkg-depends.deb
+ # Should fail due to a trigger cycle.
+ ! $(DPKG_INSTALL) pkg-trigger-a.deb pkg-trigger-b.deb
+ ! $(DPKG_CONFIGURE) --pending
+
+ # Make sure everything is left in a correct state.
+ $(call pkg_is_installed,pkg-depends)
+ $(call pkg_is_installed,pkg-trigger-a)
+ $(call pkg_status_is,pkg-trigger-b,install ok half-configured)
+
+ # Cleanup.
+ $(DPKG_PURGE) pkg-trigger-a pkg-trigger-b
+ $(DPKG_PURGE) pkg-depends
+
+test-clean:
+ -$(DPKG_PURGE) pkg-trigger-a pkg-trigger-b pkg-depends
diff --git a/tests/t-triggers-cycle/pkg-depends/DEBIAN/control b/tests/t-triggers-cycle/pkg-depends/DEBIAN/control
new file mode 100644
index 0000000..27c429f
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-depends/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-depends
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package to be configured
diff --git a/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control
new file mode 100644
index 0000000..093d8a6
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-trigger-a
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Depends: pkg-depends
+Description: test package - interested in files on /test/trigger-b/
diff --git a/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst
new file mode 100755
index 0000000..a874abf
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ configure)
+ dpkg-trigger /test/trigger-b/test-file
+ ;;
+ 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
+ dpkg-trigger /test/trigger-b/test-file
+ ;;
+esac
+
+exit 0
diff --git a/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers
new file mode 100644
index 0000000..0f10564
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers
@@ -0,0 +1 @@
+interest /test/trigger-a
diff --git a/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control
new file mode 100644
index 0000000..9cc2094
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-trigger-b
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Depends: pkg-depends
+Description: test package - interested in files on /test/trigger-a/
diff --git a/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst
new file mode 100755
index 0000000..8f1c02f
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ configure)
+ dpkg-trigger /test/trigger-a/test-file
+ ;;
+ 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
+ dpkg-trigger /test/trigger-a/test-file
+ ;;
+esac
+
+exit 0
diff --git a/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers
new file mode 100644
index 0000000..86b4728
--- /dev/null
+++ b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers
@@ -0,0 +1 @@
+interest /test/trigger-b