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.
 
 
 
 
 
 

48 lines
1.6 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. T="$1"
  12. testsuccess grep "dlstatus:1:0:Retrieving file 1 of 1" "$T"
  13. if ! grep -E -q "dlstatus:1:(0\..*|([1-9](\..*)?)|[1-9][0-9](\..*)?):Retrieving file 1 of 1" "$T"; then
  14. cat "$T"
  15. msgfail "Failed to detect download progress"
  16. fi
  17. testsuccess grep "dlstatus:1:100:Retrieving file 1 of 1" "$T"
  18. }
  19. # we need to ensure the file is reasonable big so that apt has a chance to
  20. # actually report progress - but not too big to ensure its not delaying the
  21. # test too much
  22. TESTFILE=testfile.big
  23. testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1
  24. OPT='-o APT::Status-Fd=3 -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 -o Debug::Acquire::https=1'
  25. msgtest 'download progress works via' 'http'
  26. exec 3> apt-progress.log
  27. testsuccess --nomsg apthelper download-file "http://localhost:${APTHTTPPORT}/$TESTFILE" ./downloaded/http-$TESTFILE $OPT -o Acquire::http::Dl-Limit=600
  28. assertprogress apt-progress.log
  29. msgtest 'download progress works via' 'https'
  30. for i in 1 2 3 4 5; do
  31. exec 3> apt-progress.log
  32. testsuccess --nomsg apthelper download-file "https://localhost:${APTHTTPSPORT}/$TESTFILE" ./downloaded/https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=600
  33. if [ "$(wc -l apt-progress.log | awk '{print $1}')" -ge 3 ]; then
  34. break
  35. fi
  36. done
  37. assertprogress apt-progress.log
  38. # cleanup
  39. rm -f apt-progress*.log