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.
 
 
 
 
 
 

47 lines
1.5 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. insertpackage 'wheezy' 'apt' 'all' '0.8.15'
  8. getlabelfromsuite() {
  9. echo -n 'Testcases'
  10. }
  11. setupaptarchive --no-update
  12. runtest() {
  13. local MSG="$1"
  14. msgtest "Release file is $MSG as it has" "$2"
  15. rm -rf rootdir/var/lib/apt/lists
  16. generatereleasefiles "$3"
  17. signreleasefiles
  18. shift 3
  19. if [ "$MSG" = 'accepted' ]; then
  20. testsuccess --nomsg aptget update "$@"
  21. testfailure grep -q 'is not valid yet' rootdir/tmp/testsuccess.output
  22. else
  23. testfailure --nomsg aptget update "$@"
  24. testsuccess grep -q 'is not valid yet' rootdir/tmp/testfailure.output
  25. fi
  26. }
  27. runtest 'accepted' 'no date' ''
  28. runtest 'accepted' 'ok date' 'now + 1 hour'
  29. runtest 'rejected' 'date to far in the future' 'now + 12 hours'
  30. runtest 'accepted' 'date to far in the future, but accepted via option' 'now + 12 hours' -o Acquire::Max-FutureTime=86400
  31. sed -i -e 's#\(deb\(-src\)\?\) #\1 [check-date=no] #' rootdir/etc/apt/sources.list.d/*
  32. runtest 'accepted' 'bad Date but overridden by sources option' 'now + 1 day'
  33. sed -i -e 's#\(deb\(-src\)\?\) \[.*\] #\1 [date-max-future=86400] #' rootdir/etc/apt/sources.list.d/*
  34. runtest 'accepted' 'Date allowed via sources list option via sources option' 'now + 12 hours'
  35. sed -i -e 's#\(deb\(-src\)\?\) \[.*\] #\1 [date-max-future=86405] #' rootdir/etc/apt/sources.list.d/*
  36. runtest 'rejected' 'Date further in the future than allowed by sources.list option' 'now + 2 day'