summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-814139-pickup-of-different-cache-states
blob: dffeb73ae3079e6abf97ea35dfc18ed7f32d8588 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
set -e

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

setupenvironment
configarchitecture 'amd64'

insertinstalledpackage 'build-essential' 'amd64' '1'

buildsimplenativepackage 'foo' 'all' '1' 'stable' 'Build-Depends: bar'
buildsimplenativepackage 'bar' 'all' '1' 'stable'

setupaptarchive

cp rootdir/var/lib/dpkg/status status.backup

testrun() {
	cp status.backup rootdir/var/lib/dpkg/status
	cleanup
	testdpkgnotinstalled 'bar'
	testsuccess aptget build-dep foo -y
	testdpkginstalled 'bar'
	cleanup
	cd downloaded
	testsuccess aptget source foo
	testsuccess test -s foo_1.tar.* -a -s foo_1.dsc
	rm foo_1.tar.* foo_1.dsc
	testsuccess test -d foo-1
	rm -rf foo-1
	cd ..
	cleanup
	testsuccess aptget install foo -y
}

msgmsg 'Caches fully up-to-date'
cleanup() {
	rm -f rootdir/var/cache/apt/*.bin
	testsuccess aptcache gencaches
}
testrun

msgmsg 'pkgcache.bin is missing'
cleanup() {
	rm -f rootdir/var/cache/apt/*.bin
	testsuccess aptcache gencaches
	rm rootdir/var/cache/apt/pkgcache.bin
}
testrun

msgmsg 'Caches are not writeable'
rm rootdir/var/cache/apt/*.bin
addtrap 'prefix' 'chmod 755 rootdir/var/cache/apt;'
chmod 555 rootdir/var/cache/apt
testsuccess aptcache gencaches
cleanup() {
	testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/cache/apt" '%a' '=' '555'
}
testrun