]>
Commit | Line | Data |
---|---|---|
6874a1a8 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
9962ae93 | 4 | TESTDIR=$(readlink -f $(dirname $0)) |
6874a1a8 DK |
5 | . $TESTDIR/framework |
6 | setupenvironment | |
7 | configarchitecture "i386" | |
8 | ||
9 | buildaptarchive | |
db4b5f77 | 10 | touch aptarchive/Packages |
6874a1a8 DK |
11 | setupflataptarchive |
12 | ||
13 | testaptgetupdate() { | |
8de79b68 | 14 | rm -rf rootdir/var/lib/apt |
6874a1a8 | 15 | aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true |
0c8171d7 | 16 | sed -i -e '/Ign / d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff |
6874a1a8 DK |
17 | GIVEN="$1" |
18 | shift | |
19 | msgtest "Test for correctness of" "apt-get update with $*" | |
20 | if [ -z "$GIVEN" ]; then | |
21 | echo -n "" | checkdiff - testaptgetupdate.diff && msgpass || msgfail | |
22 | else | |
23 | echo "$GIVEN" | checkdiff - testaptgetupdate.diff && msgpass || msgfail | |
24 | fi | |
25 | rm testaptgetupdate.diff | |
26 | } | |
27 | ||
4260fd39 DK |
28 | createemptyarchive() { |
29 | find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete | |
30 | if [ "en" = "$1" ]; then | |
8bcbc694 | 31 | echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS |
4260fd39 DK |
32 | fi |
33 | touch aptarchive/Packages | |
8bcbc694 | 34 | echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS |
ab53c018 | 35 | generatereleasefiles |
4260fd39 DK |
36 | signreleasefiles |
37 | rm -f aptarchive/Packages | |
38 | } | |
6874a1a8 | 39 | |
4260fd39 DK |
40 | createemptyfile() { |
41 | find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete | |
42 | if [ "en" = "$1" ]; then | |
8bcbc694 | 43 | echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS |
4260fd39 DK |
44 | fi |
45 | touch aptarchive/Packages aptarchive/${1}.$COMPRESS | |
ab53c018 | 46 | generatereleasefiles |
4260fd39 DK |
47 | signreleasefiles |
48 | rm -f aptarchive/Packages | |
49 | } | |
6874a1a8 | 50 | |
4260fd39 | 51 | testoverfile() { |
5f982b9d | 52 | forcecompressor "$1" |
6874a1a8 | 53 | |
4260fd39 | 54 | createemptyfile 'en' |
55971004 | 55 | testaptgetupdate 'Reading package lists...' "empty file en.$COMPRESS over file" |
4260fd39 DK |
56 | |
57 | createemptyarchive 'en' | |
55971004 | 58 | testaptgetupdate 'Reading package lists...' "empty archive en.$COMPRESS over file" |
4260fd39 DK |
59 | |
60 | createemptyarchive 'Packages' | |
61 | # FIXME: Why omits the file transport the Packages Get line? | |
62 | #Get:3 file: Packages [] | |
55971004 | 63 | testaptgetupdate 'Reading package lists...' "empty archive Packages.$COMPRESS over file" |
4260fd39 DK |
64 | |
65 | createemptyfile 'Packages' | |
55971004 | 66 | testaptgetupdate "Err file: Packages |
5d885723 DK |
67 | Empty files can't be valid archives |
68 | W: Failed to fetch ${COMPRESSOR}:$(readlink -f aptarchive/Packages.$COMPRESS) Empty files can't be valid archives | |
6874a1a8 | 69 | |
196c511c | 70 | E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file" |
4260fd39 | 71 | } |
6874a1a8 | 72 | |
4260fd39 | 73 | testoverhttp() { |
5f982b9d | 74 | forcecompressor "$1" |
6874a1a8 | 75 | |
4260fd39 | 76 | createemptyfile 'en' |
5b63d2a9 MV |
77 | testaptgetupdate "Get: http://localhost:8080 Packages [] |
78 | Get: http://localhost:8080 Translation-en | |
4260fd39 DK |
79 | Reading package lists..." "empty file en.$COMPRESS over http" |
80 | ||
81 | createemptyarchive 'en' | |
5b63d2a9 MV |
82 | testaptgetupdate "Get: http://localhost:8080 Packages [] |
83 | Get: http://localhost:8080 Translation-en [] | |
4260fd39 DK |
84 | Reading package lists..." "empty archive en.$COMPRESS over http" |
85 | ||
86 | createemptyarchive 'Packages' | |
5b63d2a9 | 87 | testaptgetupdate "Get: http://localhost:8080 Packages [] |
4260fd39 | 88 | Reading package lists..." "empty archive Packages.$COMPRESS over http" |
6874a1a8 | 89 | |
4260fd39 DK |
90 | createemptyfile 'Packages' |
91 | #FIXME: we should response with a good error message instead | |
5b63d2a9 MV |
92 | testaptgetupdate "Get: http://localhost:8080 Packages |
93 | Err http://localhost:8080 Packages | |
5d885723 | 94 | Empty files can't be valid archives |
b0f4b486 | 95 | W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages.${COMPRESS}) Empty files can't be valid archives |
4260fd39 | 96 | |
196c511c | 97 | E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http" |
4260fd39 DK |
98 | } |
99 | ||
79d5bab6 | 100 | for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testoverfile $COMPRESSOR; done |
4260fd39 DK |
101 | |
102 | # do the same again with http instead of file | |
103 | changetowebserver | |
6874a1a8 | 104 | |
79d5bab6 | 105 | for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testoverhttp $COMPRESSOR; done |