]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-pin-non-existent-package
generalize secure->insecure downgrade protection
[apt.git] / test / integration / test-pin-non-existent-package
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture "i386"
8
9insertpackage 'unstable' 'rapt' 'i386' '0.8.15'
10insertpackage 'unstable' 'arch' 'i386' '1.0'
11
12setupaptarchive
13
14testcandidate() {
15 msgtest "Test that the Candidate for $1 is" $2
16 if [ "$(aptcache policy $1 | grep '^ Candidate:')" = " Candidate: $2" ]; then
17 msgpass
18 else
19 echo
20 aptcache policy $1
21 msgfail
22 fi
23}
24
25testcandidate rapt '0.8.15'
26testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist
27testsuccessequal 'Reading package lists...
28Building dependency tree...
29Calculating upgrade...
300 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
31
32echo 'Package: rapt
33Pin: release a=unstable
34Pin-Priority: -1' > rootdir/etc/apt/preferences
35
36testcandidate rapt '(none)'
37testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist
38testsuccessequal 'Reading package lists...
39Building dependency tree...
40Calculating upgrade...
410 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
42
43echo '
44Package: doesntexist
45Pin: release a=unstable
46Pin-Priority: 1000' >> rootdir/etc/apt/preferences
47
48testcandidate rapt '(none)'
49
50echo '
51Package: rapt
52Pin: release a=unstable
53Pin-Priority: 1000' >> rootdir/etc/apt/preferences
54
55testcandidate rapt '(none)'
56testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist
57
58testsuccessequal 'Reading package lists...
59Building dependency tree...
60Calculating upgrade...
610 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
62
63echo 'Package: arch:amd64
64Pin: release a=unstable
65Pin-Priority: -1' > rootdir/etc/apt/preferences
66
67testcandidate arch '1.0'
68
69echo '
70Package: arch:i386
71Pin: release a=unstable
72Pin-Priority: -1' >> rootdir/etc/apt/preferences
73
74testcandidate arch '(none)'
75