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.
 
 
 
 
 
 

82 lines
2.7 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. TESTFILE="$TESTDIR/framework"
  8. cp $TESTFILE aptarchive/foo
  9. APTARCHIVE="$(readlink -f ./aptarchive)"
  10. getcodenamefromsuite() { echo "jessie"; }
  11. buildsimplenativepackage 'foo' 'all' '1.0' 'stable'
  12. setupaptarchive --no-update
  13. ln -s "${APTARCHIVE}/dists/stable" "${APTARCHIVE}/dists/jessie"
  14. for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
  15. sed 's#stable#jessie#g' $FILE > $(echo "$FILE" | sed 's#stable#jessie#g')
  16. done
  17. # install a slowed down file: otherwise its to fast to reproduce combining
  18. NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
  19. OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
  20. rm $NEWMETHODS
  21. mkdir $NEWMETHODS
  22. for METH in $(find $OLDMETHODS ! -type d); do
  23. ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS
  24. done
  25. rm $NEWMETHODS/file
  26. cat >$NEWMETHODS/file <<EOF
  27. #!/bin/sh
  28. while read line; do
  29. echo "\$line"
  30. if [ -z "\$line" ]; then
  31. sleep 0.2
  32. fi
  33. done | $OLDMETHODS/file
  34. EOF
  35. chmod +x $NEWMETHODS/file
  36. tworepos() {
  37. msgtest "Downloading the same repository twice over $1" "$3"
  38. testsuccess --nomsg aptget update -o Debug::pkgAcquire::Worker=1
  39. cp rootdir/tmp/testsuccess.output download.log
  40. #cat download.log
  41. aptget files --format '$(FILENAME)' --no-release-info | sort > file.lst
  42. testequal "$(find $(readlink -f ./rootdir/var/lib/apt/lists) -name '*_dists_*' \( ! -name '*InRelease' \) -type f | sort)" cat file.lst
  43. testsuccess aptcache policy
  44. testequal "foo:
  45. Installed: (none)
  46. Candidate: 1.0
  47. Version table:
  48. 1.0 0
  49. 500 $1:$2 jessie/main amd64 Packages
  50. 500 $1:$2 stable/main amd64 Packages" aptcache policy foo
  51. testfailure aptcache show foo/unstable
  52. testsuccess aptcache show foo/stable
  53. testsuccess aptcache show foo/jessie
  54. }
  55. tworepos 'file' "$APTARCHIVE" 'no partial'
  56. testequal '12' grep -c '200%20URI%20Start' ./download.log
  57. testequal '12' grep -c '201%20URI%20Done' ./download.log
  58. testequal '6' grep -c '^ @ Queue: Action combined' ./download.log
  59. tworepos 'file' "$APTARCHIVE" 'hit'
  60. testequal '6' grep -c '200%20URI%20Start' ./download.log
  61. testequal '6' grep -c '201%20URI%20Done' ./download.log
  62. testequal '0' grep -c '^ @ Queue: Action combined' ./download.log
  63. rm -rf rootdir/var/lib/apt/lists
  64. changetowebserver
  65. tworepos 'http' '//localhost:8080' 'no partial'
  66. testequal '10' grep -c '200%20URI%20Start' ./download.log
  67. testequal '10' grep -c '201%20URI%20Done' ./download.log
  68. testequal '6' grep -c '^ @ Queue: Action combined' ./download.log
  69. tworepos 'http' '//localhost:8080' 'hit'
  70. testequal '2' grep -c '200%20URI%20Start' ./download.log
  71. testequal '4' grep -c '201%20URI%20Done' ./download.log
  72. testequal '0' grep -c '^ @ Queue: Action combined' ./download.log
  73. rm -rf rootdir/var/lib/apt/lists