summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-get-clean
blob: 00f9d4e60cae7bc7026df1a84d9bc968e3dfda2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment
configarchitecture 'amd64'

insertpackage 'testing' 'foo' 'all' '1'
insertpackage 'unstable' 'foo' 'all' '2'
insertinstalledpackage 'foo' 'all' '3'

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/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
touch rootdir/var/cache/apt/archives/foo_4_all.deb

testsuccess aptget clean

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