]> git.saurik.com Git - apt.git/blob - test/integration/test-ubuntu-bug346386
cherry pick -r1846 from bzr+ssh://bazaar.launchpad.net/~mvo/apt/lp346386/
[apt.git] / test / integration / test-ubuntu-bug346386
1 #!/bin/sh
2 set -e
3
4 ensure_n_canary_strings_in_dir() {
5 DIR=$1
6 CANARY_STRING=$2
7 EXPECTED_N=$3
8
9 msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in $DIR"
10
11
12 N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l )
13 if [ "$N" = "$EXPECTED_N" ]; then
14 msgpass
15 return 0
16 else
17 msgfail "Expected $EXPECTED_N canaries, got $N"
18 return 1
19 fi
20 }
21
22 TESTDIR=$(readlink -f $(dirname $0))
23 . $TESTDIR/framework
24
25 setupenvironment
26 configarchitecture 'amd64'
27
28 buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
29
30 setupaptarchive
31 changetowebserver --simulate-paywall
32
33 rm -rf rootdir/var/lib/apt/lists
34 if aptget update -qq 2>/dev/null; then
35 msgfail "excpected apt-get update failure"
36 fi
37 ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "ni ni ni" 0
38 testequal 'partial' ls rootdir/var/lib/apt/lists/
39
40 # again, this time with pre-existing files valid data
41 for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do
42 echo "canary" > rootdir/var/lib/apt/lists/localhost:8080_dists_stable_${f}
43 done
44 # this will fail, the important part is that the canaries remain
45 aptget update -qq 2>/dev/null || true
46 ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "canary" 4
47