test-apt-update-reporting 859 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. for i in $(seq 100); do
  8. insertpackage 'unstable' "foo-$i" 'all' '1.0'
  9. insertsource 'unstable' "foo-$i" 'all' '1.0'
  10. done
  11. setupaptarchive --no-update
  12. changetowebserver
  13. aptget update -o Debug::Acquire::Progress=1 2>progress.log >ignore.out
  14. has_progress() {
  15. prev_percent=0.0
  16. while read line; do
  17. percent="$(echo "$line"|cut -b2-6)"
  18. # need to cut the decimal point and digits because sh can not do
  19. # float compare
  20. if [ "${percent%%.*}" -lt "${prev_percent%%.*}" ]; then
  21. cat progress.log
  22. return 1
  23. fi
  24. prev_percent="$percent"
  25. done < progress.log
  26. return 0
  27. }
  28. msgtest "Testing that progress does not go backward"
  29. testsuccess --nomsg has_progress