test-apt-progress-fd-conffile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'native'
  7. # old conffile
  8. setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
  9. BUILDDIR='incoming/compiz-core-1.0'
  10. mkdir -p ${BUILDDIR}/debian/compiz-core/etc
  11. echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
  12. echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
  13. buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
  14. rm -rf "$BUILDDIR"
  15. # new conffile
  16. setupsimplenativepackage 'compiz-core' 'native' '2.0' 'unstable'
  17. BUILDDIR='incoming/compiz-core-2.0'
  18. mkdir -p ${BUILDDIR}/debian/compiz-core/etc
  19. echo 'foo2=bar2;' > ${BUILDDIR}/compiz.conf
  20. echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
  21. buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
  22. rm -rf "$BUILDDIR"
  23. setupaptarchive
  24. testsuccess aptget install compiz-core=1.0
  25. # fake conffile change
  26. echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
  27. # FIXME: Is there really no way to see if dpkg actually prompts?
  28. msgtest 'Test for successful execution of' 'apt-get install compiz-core=2.0'
  29. OUTPUT=$(mktemp)
  30. addtrap "rm $OUTPUT;"
  31. exec 3> apt-progress.log
  32. if aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false -o dpkg::options::='--force-confold' >${OUTPUT} 2>&1; then
  33. msgpass
  34. else
  35. echo
  36. cat $OUTPUT
  37. msgfail
  38. fi
  39. # and ensure there is a conffile message in the file
  40. msgtest 'Test status fd for an included' 'pmconffile msg'
  41. grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)