]>
Commit | Line | Data |
---|---|---|
884a4c0a DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | setupenvironment | |
7 | configarchitecture 'i386' | |
8 | ||
9 | insertpackage 'wheezy' 'apt' 'all' '0.8.15' | |
10 | ||
11 | setupaptarchive | |
12 | ||
13 | setupreleasefile() { | |
14 | rm -rf rootdir/var/lib/apt/lists | |
15 | aptget clean | |
16 | generatereleasefiles "$1" "$2" | |
17 | signreleasefiles | |
18 | } | |
19 | ||
20 | aptgetupdate() { | |
21 | if aptget update $* 2>&1 | grep -q 'is expired'; then | |
22 | return 1 | |
23 | else | |
24 | return 0 | |
25 | fi | |
26 | } | |
27 | ||
28 | setupreleasefile | |
29 | msgtest 'Release file is accepted as it has' 'no Until' | |
30 | aptgetupdate && msgpass || msgfail | |
31 | ||
32 | setupreleasefile | |
33 | msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid' | |
34 | aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail | |
35 | ||
36 | setupreleasefile 'now - 2 days' | |
37 | msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' | |
38 | aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass | |
39 | ||
40 | setupreleasefile 'now - 3 days' 'now + 1 day' | |
41 | msgtest 'Release file is accepted as it has' 'good Until' | |
42 | aptgetupdate && msgpass || msgfail | |
43 | ||
44 | setupreleasefile 'now - 7 days' 'now - 4 days' | |
45 | msgtest 'Release file is rejected as it has' 'bad Until' | |
46 | aptgetupdate && msgfail || msgpass | |
47 | ||
48 | setupreleasefile 'now - 7 days' 'now - 4 days' | |
49 | msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' | |
50 | aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass | |
51 | ||
52 | setupreleasefile 'now - 7 days' 'now - 4 days' | |
53 | msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' | |
54 | aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass | |
55 | ||
56 | setupreleasefile 'now - 7 days' 'now + 4 days' | |
57 | msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' | |
58 | aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass | |
59 | ||
60 | setupreleasefile 'now - 7 days' 'now + 4 days' | |
61 | msgtest 'Release file is accepted as it has' 'good labeled Max-Valid' | |
62 | aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail | |
63 | ||
64 | setupreleasefile 'now - 7 days' 'now + 4 days' | |
65 | msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid' | |
66 | aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass | |
89500a25 DK |
67 | |
68 | setupreleasefile 'now - 7 days' 'now + 1 days' | |
69 | msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' | |
70 | aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail | |
71 | ||
72 | setupreleasefile 'now - 7 days' 'now - 4 days' | |
73 | msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' | |
74 | aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail | |
75 | ||
76 | setupreleasefile 'now - 7 days' 'now - 2 days' | |
77 | msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' | |
78 | aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 && msgpass || msgfail | |
79 | ||
80 | setupreleasefile 'now - 7 days' 'now - 2 days' | |
81 | msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' | |
82 | aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 && msgfail || msgpass | |
83 | ||
84 | setupreleasefile 'now - 7 days' 'now - 2 days' | |
85 | msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' | |
86 | aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 && msgfail || msgpass | |
87 | ||
88 | setupreleasefile 'now - 7 days' 'now - 2 days' | |
89 | msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' | |
90 | aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 && msgfail || msgpass |