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.
 
 
 
 
 
 

62 lines
1.8 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. insertpackage 'testing' 'foo' 'all' '1'
  8. insertpackage 'unstable' 'foo' 'all' '2'
  9. insertinstalledpackage 'foo' 'all' '3'
  10. setupaptarchive --no-update
  11. mkdir -p rootdir/var/lib/apt/lists/lost+found
  12. testsuccess apt update
  13. # nothing to do always works
  14. testsuccess aptget clean
  15. testsuccess aptget clean -s
  16. # generate some dirt and clean it up
  17. touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
  18. mkdir -p rootdir/var/cache/apt/archives/lost+found
  19. touch rootdir/var/cache/apt/archives/foo_1_all.deb
  20. touch rootdir/var/cache/apt/archives/foo_2_all.deb
  21. touch rootdir/var/cache/apt/archives/foo_3_all.deb
  22. touch rootdir/var/cache/apt/archives/foo_4_all.deb
  23. testsuccess aptget clean
  24. testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
  25. testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb
  26. testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb
  27. testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb
  28. testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb
  29. directorygone() {
  30. rm -rf "$1"
  31. testsuccess apt autoclean
  32. testfailure test -d "$1"
  33. testsuccess apt clean
  34. # clean creates an empty partial directory via GetLock
  35. if [ "$(basename "$1")" = 'partial' ]; then
  36. testsuccess test -d "$1"
  37. else
  38. testfailure test -d "$1"
  39. fi
  40. }
  41. msgmsg 'Partial directory missing'
  42. directorygone 'rootdir/var/cache/apt/archives/partial'
  43. directorygone 'rootdir/var/lib/apt/lists/partial'
  44. msgmsg 'Archives directory missing'
  45. directorygone 'rootdir/var/cache/apt/archives'
  46. directorygone 'rootdir/var/lib/apt/lists'
  47. msgmsg 'apt directory missing'
  48. directorygone 'rootdir/var/cache/apt'
  49. directorygone 'rootdir/var/lib/apt'