]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-sources-deb822
various changes to increase test-coverage
[apt.git] / test / integration / test-apt-sources-deb822
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture 'i386'
9
10LISTS='rootdir/etc/apt/sources.list.d/test.list'
11ABSLISTS="$(readlink -f $LISTS)"
12SOURCES='rootdir/etc/apt/sources.list.d/test.sources'
13BASE='# some comment
14# that contains a : as well
15#Types: meep
16
17Types: deb
18URIs: http://ftp.debian.org/debian
19Suites: stable
20Components: main
21Description: summay
22 and the long part'
23
24msgcleantest() {
25 rm -f $LISTS $SOURCES
26 msgtest "$@"
27}
28
29msgcleantest 'Test sources.list' 'old style'
30echo "deb http://ftp.debian.org/debian stable main" > $LISTS
31testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
32'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
33'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
34
35msgcleantest 'Test sources.list' 'old style with tabs'
36echo "deb http://ftp.debian.org/debian stable main" > $LISTS
37testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
38'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
39'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
40
41msgcleantest 'Test sources.list' 'old style with forgotten end for options'
42echo "deb [trusted=yes arch+=armel,powerpc http://ftp.debian.org/debian stable main" > $LISTS
43testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] not assignment)
44E: The list of sources could not be read." aptget update --print-uris
45
46msgcleantest 'Test sources.list' 'old style with stray ] instead of options'
47echo "deb ] http://ftp.debian.org/debian stable main" > $LISTS
48testfailureequal "E: Malformed entry 1 in list file $ABSLISTS (URI parse)
49E: The list of sources could not be read." aptget update --print-uris
50
51msgcleantest 'Test sources.list' 'old style options no key'
52echo "deb [=test] http://ftp.debian.org/debian stable main" > $LISTS
53testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no key)
54E: The list of sources could not be read." aptget update --print-uris
55
56msgcleantest 'Test sources.list' 'old style options no value'
57echo "deb [test=] http://ftp.debian.org/debian stable main" > $LISTS
58testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no value)
59E: The list of sources could not be read." aptget update --print-uris
60
61msgcleantest 'Test sources.list' 'old style with options'
62echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS
63testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
64'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
65'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0
66'http://ftp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-powerpc_Packages 0
67'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
68
69msgcleantest 'Test sources.list' 'old style with comments'
70echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS
71testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
72'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
73'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
74
75msgcleantest 'Test sources.list' 'old style with option comments'
76echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS
77testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
78'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
79'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
80
81msgcleantest 'Test sources.list' 'simple deb822'
82echo "$BASE" > $SOURCES
83testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
84'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
85'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
86
87msgcleantest 'Test deb822 with' 'two entries'
88# Two entries
89echo "$BASE" > $SOURCES
90echo "" >> $SOURCES
91echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
92testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
93'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
94'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
95'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
96'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
97'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
98
99# two suite entries
100msgcleantest 'Test deb822 with' 'two Suite entries'
101echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
102testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
103'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
104'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
105'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
106'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
107'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
108
109msgcleantest 'Test deb822' 'architecture option'
110echo "$BASE" > $SOURCES
111echo "Architectures: amd64 armel" >> $SOURCES
112testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
113'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0
114'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0
115'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
116
117msgcleantest 'Test old-style' 'suite arch variable'
118echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS
119testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/unstable/binary-i386/InRelease' ftp.tlh.debian.org_universe_unstable_binary-i386_InRelease 0
120'http://ftp.tlh.debian.org/universe/unstable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_Packages 0
121'http://ftp.tlh.debian.org/universe/unstable/binary-i386/en.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_en 0 " aptget update --print-uris
122
123msgcleantest 'Test deb822' 'suite arch variable'
124echo 'Types: deb
125URIs: http://ftp.tlh.debian.org/universe
126Suites: stable/binary-$(ARCH)/' > $SOURCES
127testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/stable/binary-i386/InRelease' ftp.tlh.debian.org_universe_stable_binary-i386_InRelease 0
128'http://ftp.tlh.debian.org/universe/stable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_stable_binary-i386_Packages 0
129'http://ftp.tlh.debian.org/universe/stable/binary-i386/en.xz' ftp.tlh.debian.org_universe_stable_binary-i386_en 0 " aptget update --print-uris
130
131msgcleantest 'Test old-style sources.list file which has' 'malformed dist'
132echo "deb http://ftp.debian.org" > $LISTS
133testfailureequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite)
134E: The list of sources could not be read." aptget update --print-uris
135
136msgcleantest 'Test deb822 sources.list file which has' 'malformed URI'
137echo "Types: deb
138Suites: stable
139" > $SOURCES
140testfailureequal --nomsg "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI)
141E: The list of sources could not be read." aptget update --print-uris
142
143# with Enabled: false
144echo "$BASE" > $SOURCES
145echo "Enabled: no" >> $SOURCES
146testempty aptget update --print-uris
147
148# multiple URIs
149msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work'
150echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
151testsuccessequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
152'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0
153'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0
154'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
155'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
156'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
157
158# multiple Type in one field
159msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work'
160echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
161testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
162'http://ftp.debian.org/debian/dists/stable/main/source/Sources.xz' ftp.debian.org_debian_dists_stable_main_source_Sources 0
163'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
164'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
165
166# a Suite
167msgcleantest 'Test deb822 sources.list file which has' 'an exact path and no sections'
168cat > $SOURCES <<EOF
169Types: deb
170URIs: http://emacs.naquadah.org
171Suites: stable/
172EOF
173testsuccessequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0
174'http://emacs.naquadah.org/stable/Packages.xz' emacs.naquadah.org_stable_Packages 0
175'http://emacs.naquadah.org/stable/en.xz' emacs.naquadah.org_stable_en 0 " aptget update --print-uris