test-bug-814139-pickup-of-different-cache-states 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. insertinstalledpackage 'build-essential' 'amd64' '1'
  8. buildsimplenativepackage 'foo' 'all' '1' 'stable' 'Build-Depends: bar'
  9. buildsimplenativepackage 'bar' 'all' '1' 'stable'
  10. setupaptarchive
  11. cp rootdir/var/lib/dpkg/status status.backup
  12. testrun() {
  13. cp status.backup rootdir/var/lib/dpkg/status
  14. cleanup
  15. testdpkgnotinstalled 'bar'
  16. testsuccess aptget build-dep foo -y
  17. testdpkginstalled 'bar'
  18. cleanup
  19. cd downloaded
  20. testsuccess aptget source foo
  21. testsuccess test -s foo_1.tar.* -a -s foo_1.dsc
  22. rm foo_1.tar.* foo_1.dsc
  23. testsuccess test -d foo-1
  24. rm -rf foo-1
  25. cd ..
  26. cleanup
  27. testsuccess aptget install foo -y
  28. }
  29. msgmsg 'Caches fully up-to-date'
  30. cleanup() {
  31. rm -f rootdir/var/cache/apt/*.bin
  32. testsuccess aptcache gencaches
  33. }
  34. testrun
  35. msgmsg 'pkgcache.bin is missing'
  36. cleanup() {
  37. rm -f rootdir/var/cache/apt/*.bin
  38. testsuccess aptcache gencaches
  39. rm rootdir/var/cache/apt/pkgcache.bin
  40. }
  41. testrun
  42. msgmsg 'Caches are not writeable'
  43. rm rootdir/var/cache/apt/*.bin
  44. addtrap 'prefix' 'chmod 755 rootdir/var/cache/apt;'
  45. chmod 555 rootdir/var/cache/apt
  46. testsuccess aptcache gencaches
  47. cleanup() {
  48. testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/cache/apt" '%a' '=' '555'
  49. }
  50. testrun