test-bug-769609-triggers-still-pending-after-run 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. msgtest 'Check if installed dpkg supports' 'noawait trigger'
  8. if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.16.1'; then
  9. msgpass
  10. else
  11. msgskip 'dpkg version too old'
  12. exit 0
  13. fi
  14. configdpkgnoopchroot
  15. buildtriggerpackages() {
  16. local TYPE="$1"
  17. setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE"
  18. BUILDDIR="incoming/triggerable-${TYPE}-1.0"
  19. cat >"${BUILDDIR}/debian/postinst" <<EOF
  20. #!/bin/sh
  21. if [ "\$1" = 'triggered' ]; then
  22. echo "TRIGGER IS RUNNING"
  23. fi
  24. EOF
  25. echo "$TYPE /usr/share/doc" > "${BUILDDIR}/debian/triggers"
  26. buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
  27. rm -rf "$BUILDDIR"
  28. buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable'
  29. }
  30. #buildtriggerpackages 'interest'
  31. buildtriggerpackages 'interest-noawait'
  32. buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable'
  33. setupaptarchive
  34. runtests() {
  35. local TYPE="$1"
  36. msgmsg 'Working with trigger type' "$TYPE"
  37. testsuccess aptget install triggerable-$TYPE -y
  38. cp rootdir/tmp/testsuccess.output terminal.output
  39. testsuccess grep '^REWRITE ' terminal.output
  40. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
  41. testsuccess aptget install trigdepends-$TYPE -y --reinstall
  42. cp rootdir/tmp/testsuccess.output terminal.output
  43. testsuccess grep '^REWRITE ' terminal.output
  44. testsuccess grep 'TRIGGER IS RUNNING' terminal.output
  45. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
  46. testsuccess aptget install trigstuff -y
  47. cp rootdir/tmp/testsuccess.output terminal.output
  48. testsuccess grep '^REWRITE ' terminal.output
  49. testsuccess grep 'TRIGGER IS RUNNING' terminal.output
  50. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff
  51. testsuccess aptget purge trigstuff -y
  52. cp rootdir/tmp/testsuccess.output terminal.output
  53. testsuccess grep '^REWRITE ' terminal.output
  54. testsuccess grep 'TRIGGER IS RUNNING' terminal.output
  55. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
  56. testdpkgnotinstalled trigstuff
  57. testsuccess aptget purge trigdepends-$TYPE -y
  58. cp rootdir/tmp/testsuccess.output terminal.output
  59. testfailure grep '^REWRITE ' terminal.output
  60. testfailure grep 'TRIGGER IS RUNNING' terminal.output
  61. testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
  62. }
  63. #runtests 'interest'
  64. runtests 'interest-noawait'