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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; 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. ls -l /proc/self/fd/
  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. # FIXME: implement test with activate-style triggers
  31. #buildtriggerpackages 'interest'
  32. buildtriggerpackages 'interest-noawait'
  33. buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable'
  34. setupaptarchive
  35. runtests() {
  36. local TYPE="$1"
  37. msgmsg 'Working with trigger type' "$TYPE"
  38. testsuccess aptget install triggerable-$TYPE -y
  39. cp rootdir/tmp/testsuccess.output terminal.output
  40. testsuccess grep '^REWRITE ' terminal.output
  41. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
  42. testsuccess aptget install trigdepends-$TYPE -y --reinstall
  43. cp rootdir/tmp/testsuccess.output terminal.output
  44. testsuccess grep '^REWRITE ' terminal.output
  45. testsuccess grep ' root root ' terminal.output
  46. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
  47. testsuccess aptget install trigstuff -y
  48. cp rootdir/tmp/testsuccess.output terminal.output
  49. testsuccess grep '^REWRITE ' terminal.output
  50. testsuccess grep ' root root ' terminal.output
  51. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff
  52. testsuccess aptget purge trigstuff -y
  53. cp rootdir/tmp/testsuccess.output terminal.output
  54. testsuccess grep '^REWRITE ' terminal.output
  55. testsuccess grep ' root root ' terminal.output
  56. testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
  57. testdpkgnotinstalled trigstuff
  58. testsuccess aptget purge trigdepends-$TYPE -y
  59. cp rootdir/tmp/testsuccess.output terminal.output
  60. testfailure grep '^REWRITE ' terminal.output
  61. testfailure grep ' root root ' terminal.output
  62. testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
  63. }
  64. #runtests 'interest'
  65. runtests 'interest-noawait'