test-apt-update-filesize-mismatch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. configcompression 'gz'
  8. insertpackage 'testing' 'foo' 'all' '1'
  9. insertpackage 'testing' 'foo2' 'all' '1'
  10. insertsource 'testing' 'foo' 'all' '1'
  11. insertsource 'testing' 'foo2' 'all' '1'
  12. setupaptarchive --no-update
  13. changetowebserver
  14. find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete
  15. for release in $(find aptarchive -name 'Release'); do
  16. cp "$release" "${release}.backup"
  17. done
  18. testsuccess aptget update
  19. testsuccess aptcache show foo
  20. testsuccess aptget install foo -s
  21. for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log.client*.log); do
  22. for ext in '' '.gz'; do
  23. COMPRESSFILE="$get"
  24. get="${get}${ext}"
  25. FILE="$(basename "$get" '.gz')"
  26. msgmsg 'Test filesize mismatch with file' "$FILE"
  27. rm -rf rootdir/var/lib/apt/lists
  28. for release in $(find aptarchive -name 'Release'); do
  29. SIZE="$(awk "/$FILE\$/ { print \$2; exit }" "${release}.backup")"
  30. sed "s# $SIZE # $(($SIZE + 111)) #" "${release}.backup" > "$release"
  31. done
  32. signreleasefiles
  33. testfailure aptget update -o Debug::pkgAcquire::Worker=1
  34. cp rootdir/tmp/testfailure.output rootdir/tmp/update.output
  35. testsuccess grep -E "$(basename "$COMPRESSFILE" '.gz').*Hash Sum mismatch" rootdir/tmp/update.output
  36. testfailure aptcache show foo
  37. testfailure aptget install foo -s
  38. testfailure aptcache show bar
  39. testfailure aptget install bar -s
  40. done
  41. done