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.
 
 
 
 
 
 

160 lines
4.7 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. buildaptarchive
  8. setupflataptarchive
  9. changetowebserver
  10. prepare() {
  11. local DATE="${2:-now}"
  12. if [ "$DATE" = 'now' -a "$1" = "${PKGFILE}-new" ]; then
  13. DATE='now + 6 days'
  14. fi
  15. for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
  16. touch -d 'now - 6 hours' $release
  17. done
  18. aptget clean
  19. cp $1 aptarchive/Packages
  20. find aptarchive -name 'Release' -delete
  21. cat aptarchive/Packages | gzip > aptarchive/Packages.gz
  22. cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
  23. cat aptarchive/Packages | lzma > aptarchive/Packages.lzma
  24. generatereleasefiles "$DATE"
  25. }
  26. installaptold() {
  27. testequal 'Reading package lists...
  28. Building dependency tree...
  29. Suggested packages:
  30. aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
  31. The following NEW packages will be installed:
  32. apt
  33. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  34. After this operation, 5370 kB of additional disk space will be used.
  35. Get:1 http://localhost/ apt 0.7.25.3
  36. Download complete and in download only mode' aptget install apt -dy
  37. }
  38. installaptnew() {
  39. testequal 'Reading package lists...
  40. Building dependency tree...
  41. Suggested packages:
  42. aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
  43. The following NEW packages will be installed:
  44. apt
  45. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  46. After this operation, 5808 kB of additional disk space will be used.
  47. Get:1 http://localhost/ apt 0.8.0~pre1
  48. Download complete and in download only mode' aptget install apt -dy
  49. }
  50. failaptold() {
  51. testequal 'Reading package lists...
  52. Building dependency tree...
  53. Suggested packages:
  54. aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
  55. The following NEW packages will be installed:
  56. apt
  57. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  58. After this operation, 5370 kB of additional disk space will be used.
  59. WARNING: The following packages cannot be authenticated!
  60. apt
  61. E: There are problems and -y was used without --force-yes' aptget install apt -dy
  62. }
  63. failaptnew() {
  64. testequal 'Reading package lists...
  65. Building dependency tree...
  66. Suggested packages:
  67. aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
  68. The following NEW packages will be installed:
  69. apt
  70. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  71. After this operation, 5808 kB of additional disk space will be used.
  72. WARNING: The following packages cannot be authenticated!
  73. apt
  74. E: There are problems and -y was used without --force-yes' aptget install apt -dy
  75. }
  76. # fake our downloadable file
  77. touch aptarchive/apt.deb
  78. PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
  79. runtest() {
  80. prepare ${PKGFILE}
  81. rm -rf rootdir/var/lib/apt/lists
  82. signreleasefiles 'Joe Sixpack'
  83. find aptarchive/ -name "$DELETEFILE" -delete
  84. msgtest 'Cold archive signed by' 'Joe Sixpack'
  85. aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
  86. testequal "$(cat ${PKGFILE})
  87. " aptcache show apt
  88. installaptold
  89. prepare ${PKGFILE}-new
  90. signreleasefiles 'Joe Sixpack'
  91. find aptarchive/ -name "$DELETEFILE" -delete
  92. msgtest 'Good warm archive signed by' 'Joe Sixpack'
  93. aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
  94. testequal "$(cat ${PKGFILE}-new)
  95. " aptcache show apt
  96. installaptnew
  97. prepare ${PKGFILE}
  98. rm -rf rootdir/var/lib/apt/lists
  99. signreleasefiles 'Marvin Paranoid'
  100. find aptarchive/ -name "$DELETEFILE" -delete
  101. msgtest 'Cold archive signed by' 'Marvin Paranoid'
  102. aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail
  103. testequal "$(cat ${PKGFILE})
  104. " aptcache show apt
  105. failaptold
  106. prepare ${PKGFILE}-new
  107. # weborf doesn't support If-Range
  108. for release in $(find rootdir/var/lib/apt/lists/partial/ -name '*Release'); do
  109. rm $release
  110. touch $release
  111. done
  112. signreleasefiles 'Joe Sixpack'
  113. find aptarchive/ -name "$DELETEFILE" -delete
  114. msgtest 'Bad warm archive signed by' 'Joe Sixpack'
  115. aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
  116. testequal "$(cat ${PKGFILE}-new)
  117. " aptcache show apt
  118. installaptnew
  119. prepare ${PKGFILE}
  120. rm -rf rootdir/var/lib/apt/lists
  121. signreleasefiles 'Joe Sixpack'
  122. find aptarchive/ -name "$DELETEFILE" -delete
  123. msgtest 'Cold archive signed by' 'Joe Sixpack'
  124. aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
  125. testequal "$(cat ${PKGFILE})
  126. " aptcache show apt
  127. installaptold
  128. prepare ${PKGFILE}-new
  129. signreleasefiles 'Marvin Paranoid'
  130. find aptarchive/ -name "$DELETEFILE" -delete
  131. msgtest 'Good warm archive signed by' 'Marvin Paranoid'
  132. aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail
  133. testequal "$(cat ${PKGFILE})
  134. " aptcache show apt
  135. installaptold
  136. }
  137. DELETEFILE="InRelease"
  138. runtest
  139. DELETEFILE="Release.gpg"
  140. runtest