]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-407511-fail-invalid-default-release
improve test for #731853 and comments
[apt.git] / test / integration / test-bug-407511-fail-invalid-default-release
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'i386'
8
9 insertpackage 'unstable' 'cool' 'all' '1.0-1'
10
11 getcodenamefromsuite() {
12 if [ "$SUITE" = 'unstable' ]; then
13 echo -n 'sid'
14 else
15 echo -n "$SUITE"
16 fi
17 }
18 getreleaseversionfromsuite() {
19 if [ "$SUITE" = 'unstable' ]; then
20 echo -n '42.0'
21 else
22 echo -n '0.8.15'
23 fi
24 }
25
26 getlabelfromsuite() {
27 if [ "$SUITE" = 'unstable' ]; then
28 echo -n 'UnstableTestcases'
29 else
30 echo -n 'Testcases'
31 fi
32 }
33
34 setupaptarchive
35
36 passdist() {
37 msgtest 'Test that target-release is accepted' $1
38 testsuccess --nomsg aptget dist-upgrade -t $1
39 msgtest 'Test that target-release pins with' $1
40 aptcache policy -t $1 | grep -q ' 990' && msgpass || msgfail
41 }
42
43 faildist() {
44 msgtest 'Test that target-release is refused' $1
45 testfailure --nomsg aptget dist-upgrade -t $1
46 }
47
48 msgtest 'Test that no default-release is active in this test' 'setup'
49 aptcache policy | grep -q ' 990' && msgfall || msgpass
50
51 passdist unstable
52 passdist sid
53 faildist sidd
54 faildist stable
55 passdist 42.0
56 passdist 42.*
57 passdist 42*
58 passdist 4*.0
59 faildist 21.0
60 faildist 21*
61 # we accept, but don't validate the following
62 passdist a=unstable
63 passdist n=sid
64 passdist v=42.0
65 passdist c=main
66 passdist l=UnstableTestcases