You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

133 lines
4.8 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. buildsimplenativepackage "testpkg" "i386" "1.0"
  8. setupaptarchive
  9. local GOODSHOW="$(aptcache show testpkg)
  10. "
  11. local GOODPOLICY="$(aptcache policy testpkg)"
  12. local GOODSHOWSRC="$(aptcache showsrc testpkg)
  13. "
  14. test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3
  15. testequal "$GOODSHOW" aptcache show testpkg
  16. test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4
  17. testequal "$GOODPOLICY" aptcache policy testpkg
  18. test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4
  19. testequal "$GOODSHOWSRC" aptcache showsrc testpkg
  20. testrun() {
  21. local F
  22. if [ -e rootdir/var/lib/apt/lists/*localhost*Release ]; then
  23. msgtest "Check if all index files are" "${1:-uncompressed}"
  24. if [ "$1" = "compressed" ]; then
  25. ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1
  26. ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1
  27. test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1
  28. test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1
  29. else
  30. test -e rootdir/var/lib/apt/lists/*_Packages || F=1
  31. test -e rootdir/var/lib/apt/lists/*_Sources || F=1
  32. ! test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1
  33. ! test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1
  34. fi
  35. if [ -n "$F" ]; then
  36. ls -laR rootdir/var/lib/apt/lists/
  37. msgfail
  38. else
  39. msgpass
  40. fi
  41. msgtest "Check if package is downloadable"
  42. aptget install -d testpkg -qq && msgpass || msgfail
  43. msgtest "\tdeb file is present"; test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
  44. aptget clean
  45. msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
  46. fi
  47. rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
  48. testequal "$GOODSHOW" aptcache show testpkg
  49. testequal "$GOODSHOW" aptcache show testpkg
  50. rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
  51. testequal "$GOODPOLICY" aptcache policy testpkg
  52. testequal "$GOODPOLICY" aptcache policy testpkg
  53. rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
  54. testequal "$GOODSHOWSRC" aptcache showsrc testpkg
  55. testequal "$GOODSHOWSRC" aptcache showsrc testpkg
  56. rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
  57. rm -rf rootdir/var/cache/apt/archives
  58. msgtest "Check if the source is aptgetable"
  59. aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail
  60. msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail
  61. msgtest "\tdirectory is present"; test -d testpkg-1.0 && msgpass || msgfail
  62. rm -rf testpkg-1.0
  63. }
  64. echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex
  65. msgmsg "File: Test with uncompressed indexes"
  66. testrun
  67. aptget update -qq -o Acquire::Pdiffs=1
  68. msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)"
  69. testrun
  70. aptget update -qq -o Acquire::Pdiffs=0
  71. msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)"
  72. testrun
  73. rm -rf rootdir/var/lib/apt/lists
  74. echo 'Acquire::CompressionTypes::Order:: "gz";
  75. Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
  76. aptget update -qq
  77. msgmsg "File: Test with compressed indexes"
  78. testrun "compressed"
  79. aptget update -qq -o Acquire::Pdiffs=1
  80. msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)"
  81. testrun "compressed"
  82. aptget update -qq -o Acquire::Pdiffs=0
  83. msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)"
  84. testrun "compressed"
  85. rm rootdir/etc/apt/apt.conf.d/02compressindex
  86. changetowebserver
  87. aptget update -qq
  88. local GOODPOLICY="$(aptcache policy testpkg)"
  89. test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4
  90. testequal "$GOODPOLICY" aptcache policy testpkg
  91. msgmsg "HTTP: Test with uncompressed indexes"
  92. testrun
  93. aptget update -qq -o Acquire::Pdiffs=1
  94. msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
  95. testrun
  96. aptget update -qq -o Acquire::Pdiffs=0
  97. msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)"
  98. testrun
  99. rm -rf rootdir/var/lib/apt/lists
  100. echo 'Acquire::CompressionTypes::Order:: "gz";
  101. Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
  102. aptget update -qq
  103. msgmsg "HTTP: Test with compressed indexes"
  104. testrun "compressed"
  105. aptget update -qq -o Acquire::Pdiffs=1
  106. msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
  107. testrun "compressed"
  108. aptget update -qq -o Acquire::Pdiffs=0
  109. msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"
  110. testrun "compressed"