This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=893514e4bb60bca7e8078932db932afa52af5bb6

commit 893514e4bb60bca7e8078932db932afa52af5bb6
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Oct 11 15:06:27 2015 +0200

    t-triggers-configure: New test case
    
    Bug-Debian: https://bugs.debian.org/801156
---
 Makefile                                           |  6 +++++-
 t-triggers-configure/Makefile                      | 22 ++++++++++++++++++++++
 .../pkg-activate/DEBIAN/control                    |  2 +-
 .../pkg-activate}/test/trigger/test-file           |  0
 .../pkg-interest-0}/DEBIAN/control                 |  0
 .../pkg-interest-0/DEBIAN/triggers                 |  1 +
 .../pkg-interest-1}/DEBIAN/control                 |  2 +-
 .../pkg-interest-1/DEBIAN/postinst                 | 15 +++++++++++++++
 .../pkg-interest-1/DEBIAN/triggers                 |  1 +
 9 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 9b6f5a9cc..e090871bd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 #
 # Dpkg functional testsuite (kind of)
 #
-# Copyright © 2008-2013 Guillem Jover <[email protected]>
+# Copyright © 2008-2015 Guillem Jover <[email protected]>
 #
 
 DPKG_SERIES := 1.18.x
@@ -36,6 +36,7 @@ ifeq ($(call CHECK_VERSION,$(DPKG_SERIES),ge,1.18.x),yes)
 $(info using dpkg >= 1.18.x)
 export DPKG_HAS_TRIGPROC_DEPCHECK := 1
 export DPKG_HAS_SAME_RUN_BIDIRECTIONAL_CONFLICTS := 1
+export DPKG_HAS_WORKING_TRIGGERS_PENDING_UPGRADE := 1
 # once apt is fixed:
 #export DPKG_HAS_CONFIGURE_WITH_IMPLICIT_TRIGGER_PENDING := 1
 endif
@@ -90,6 +91,9 @@ TESTS_PASS += t-conflict-provide-replace-virtual-multiarch
 TESTS_PASS += t-conflict-provide-replace-interface
 TESTS_PASS += t-predepends-no-triggers
 TESTS_PASS += t-triggers
+ifdef DPKG_HAS_WORKING_TRIGGERS_PENDING_UPGRADE
+TESTS_PASS += t-triggers-configure
+endif
 TESTS_PASS += t-triggers-path
 TESTS_PASS += t-triggers-depends
 # This only works with dpkg >= 1.18.x
diff --git a/t-triggers-configure/Makefile b/t-triggers-configure/Makefile
new file mode 100644
index 000000000..96996b29a
--- /dev/null
+++ b/t-triggers-configure/Makefile
@@ -0,0 +1,22 @@
+TESTS_DEB := pkg-activate pkg-interest-0 pkg-interest-1
+
+include ../Test.mk
+
+test-case:
+       $(DPKG_INSTALL) pkg-interest-0.deb
+
+       # Activate the trigger, and leave pkg-interest in triggers-pending.
+       $(DPKG_INSTALL) --no-triggers pkg-activate.deb
+       $(call pkg_status_is,pkg-interest,install ok triggers-pending)
+
+       # Test that an upgrade from triggers-pending passes the previous
+       # configured version to "postinst configure".
+       $(DPKG_INSTALL) pkg-interest-1.deb
+
+       # Cleanup.
+       $(DPKG_PURGE) pkg-interest
+       $(DPKG_PURGE) pkg-activate
+
+test-clean:
+       -$(DPKG_PURGE) pkg-interest
+       -$(DPKG_PURGE) pkg-activate
diff --git a/t-triggers-depends/pkg-activate/DEBIAN/control 
b/t-triggers-configure/pkg-activate/DEBIAN/control
similarity index 67%
copy from t-triggers-depends/pkg-activate/DEBIAN/control
copy to t-triggers-configure/pkg-activate/DEBIAN/control
index e6c4ab547..b8a6cc967 100644
--- a/t-triggers-depends/pkg-activate/DEBIAN/control
+++ b/t-triggers-configure/pkg-activate/DEBIAN/control
@@ -4,4 +4,4 @@ Section: test
 Priority: extra
 Maintainer: Dpkg Developers <[email protected]>
 Architecture: all
-Description: test package - activate a trigger on /test/trigger/
+Description: test package - activates triggers interested in /test/
diff --git a/t-triggers-depcycle/pkg-files-0/test/trigger/test-file 
b/t-triggers-configure/pkg-activate/test/trigger/test-file
similarity index 100%
copy from t-triggers-depcycle/pkg-files-0/test/trigger/test-file
copy to t-triggers-configure/pkg-activate/test/trigger/test-file
diff --git a/t-triggers-path/pkg-interest/DEBIAN/control 
b/t-triggers-configure/pkg-interest-0/DEBIAN/control
similarity index 100%
copy from t-triggers-path/pkg-interest/DEBIAN/control
copy to t-triggers-configure/pkg-interest-0/DEBIAN/control
diff --git a/t-triggers-configure/pkg-interest-0/DEBIAN/triggers 
b/t-triggers-configure/pkg-interest-0/DEBIAN/triggers
new file mode 100644
index 000000000..97d27a247
--- /dev/null
+++ b/t-triggers-configure/pkg-interest-0/DEBIAN/triggers
@@ -0,0 +1 @@
+interest-noawait /test
diff --git a/t-triggers-path/pkg-interest/DEBIAN/control 
b/t-triggers-configure/pkg-interest-1/DEBIAN/control
similarity index 94%
copy from t-triggers-path/pkg-interest/DEBIAN/control
copy to t-triggers-configure/pkg-interest-1/DEBIAN/control
index e5a1833e7..59c323b37 100644
--- a/t-triggers-path/pkg-interest/DEBIAN/control
+++ b/t-triggers-configure/pkg-interest-1/DEBIAN/control
@@ -1,5 +1,5 @@
 Package: pkg-interest
-Version: 0
+Version: 1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <[email protected]>
diff --git a/t-triggers-configure/pkg-interest-1/DEBIAN/postinst 
b/t-triggers-configure/pkg-interest-1/DEBIAN/postinst
new file mode 100755
index 000000000..69ad9b50b
--- /dev/null
+++ b/t-triggers-configure/pkg-interest-1/DEBIAN/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+  configure)
+    if [ -z "$2" ]; then
+       echo "FAIL: upgrading and no previous version passed to configure" 2>&1
+       exit 1
+    else
+       echo "PASS: upgrading from version '$2'"
+    fi
+  ;;
+esac
+
+exit 0
diff --git a/t-triggers-configure/pkg-interest-1/DEBIAN/triggers 
b/t-triggers-configure/pkg-interest-1/DEBIAN/triggers
new file mode 100644
index 000000000..97d27a247
--- /dev/null
+++ b/t-triggers-configure/pkg-interest-1/DEBIAN/triggers
@@ -0,0 +1 @@
+interest-noawait /test

-- 
Dpkg.Org's dpkg

Reply via email to