]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-apt-get-clean
test-apt-download-progress: Allow smaller progress change
[apt.git] / test / integration / test-apt-get-clean
index 98f7c84d0f4e0458b9be0e2bdfc27372a27f70fc..78cb95d746d48e362dc9654a43b5c4e8069faffa 100755 (executable)
@@ -11,14 +11,18 @@ insertpackage 'testing' 'foo' 'all' '1'
 insertpackage 'unstable' 'foo' 'all' '2'
 insertinstalledpackage 'foo' 'all' '3'
 
-setupaptarchive
+setupaptarchive --no-update
+
+mkdir -p rootdir/var/lib/apt/lists/lost+found
+testsuccess apt update
 
 # nothing to do always works
 testsuccess aptget clean
+testsuccess aptget clean -s
 
 # generate some dirt and clean it up
 touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
-mkdir -p rootdir/var/cache/apt/archives
+mkdir -p rootdir/var/cache/apt/archives/lost+found
 touch rootdir/var/cache/apt/archives/foo_1_all.deb
 touch rootdir/var/cache/apt/archives/foo_2_all.deb
 touch rootdir/var/cache/apt/archives/foo_3_all.deb
@@ -26,10 +30,32 @@ touch rootdir/var/cache/apt/archives/foo_4_all.deb
 
 testsuccess aptget clean
 
-testsuccess test ! -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
-testsuccess test ! -e rootdir/var/cache/apt/archives/foo_1_all.deb
-testsuccess test ! -e rootdir/var/cache/apt/archives/foo_2_all.deb
-testsuccess test ! -e rootdir/var/cache/apt/archives/foo_3_all.deb
-testsuccess test ! -e rootdir/var/cache/apt/archives/foo_4_all.deb
-
-
+testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
+testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb
+testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb
+testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb
+testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb
+
+directorygone() {
+       rm -rf "$1"
+       testsuccess apt autoclean
+       testfailure test -d "$1"
+       testsuccess apt clean
+       # clean creates an empty partial directory via GetLock
+       if [ "$(basename "$1")" = 'partial' ]; then
+               testsuccess test -d "$1"
+       else
+               testfailure test -d "$1"
+       fi
+}
+msgmsg 'Partial directory missing'
+directorygone 'rootdir/var/cache/apt/archives/partial'
+directorygone 'rootdir/var/lib/apt/lists/partial'
+
+msgmsg 'Archives directory missing'
+directorygone 'rootdir/var/cache/apt/archives'
+directorygone 'rootdir/var/lib/apt/lists'
+
+msgmsg 'apt directory missing'
+directorygone 'rootdir/var/cache/apt'
+directorygone 'rootdir/var/lib/apt'