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.
 
 
 
 
 
 

49 lines
1.7 KiB

  1. #!/bin/sh
  2. #
  3. # ensure downloading sends progress as a regression test for commit 9127d7ae
  4. #
  5. set -e
  6. TESTDIR="$(readlink -f "$(dirname "$0")")"
  7. . "$TESTDIR/framework"
  8. setupenvironment
  9. changetohttpswebserver
  10. assertprogress() {
  11. testsuccess grep "dlstatus:1:0.0000:Retrieving file 1 of 1" "$1"
  12. testsuccess grep -E "dlstatus:1:[1-9][0-9]{0,1}\.[0-9]{1,4}:Retrieving file 1 of 1" "$1"
  13. testsuccess grep "dlstatus:1:100.0000:Retrieving file 1 of 1" "$1"
  14. }
  15. # we need to ensure the file is reasonable big so that apt has a chance to
  16. # actually report progress - but not too big to ensure its not delaying the
  17. # test too much
  18. TESTFILE=testfile.big
  19. testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=1600k count=1
  20. OPT='-o APT::Status-Fd=3 -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 -o Debug::Acquire::https=1'
  21. msgtest 'download progress works via' 'http'
  22. for i in 2 5 7 10 12 15; do
  23. exec 3> apt-progress-http.log
  24. testsuccess --nomsg apthelper download-file "http://localhost:${APTHTTPPORT}/$TESTFILE" ./downloaded/http-$TESTFILE $OPT -o Acquire::http::Dl-Limit=$((1600/i))
  25. if [ "$(wc -l apt-progress-http.log | awk '{print $1}')" -ge 3 ]; then
  26. break
  27. fi
  28. done
  29. assertprogress apt-progress-http.log
  30. msgtest 'download progress works via' 'https'
  31. for i in 2 5 7 10 12 15; do
  32. exec 3> apt-progress-https.log
  33. testsuccess --nomsg apthelper download-file "https://localhost:${APTHTTPSPORT}/$TESTFILE" ./downloaded/https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=$((1600/i))
  34. if [ "$(wc -l apt-progress-https.log | awk '{print $1}')" -ge 3 ]; then
  35. break
  36. fi
  37. done
  38. assertprogress apt-progress-https.log
  39. # cleanup
  40. rm -f apt-progress*.log