Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # ex:ts=4:sw=4:sts=4:et |
| 2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- |
| 3 | # |
| 4 | # BitBake Tests for the Fetcher (fetch2/) |
| 5 | # |
| 6 | # Copyright (C) 2012 Richard Purdie |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License version 2 as |
| 10 | # published by the Free Software Foundation. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License along |
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | # |
| 21 | |
| 22 | import unittest |
| 23 | import tempfile |
| 24 | import subprocess |
| 25 | import os |
| 26 | from bb.fetch2 import URI |
| 27 | from bb.fetch2 import FetchMethod |
| 28 | import bb |
| 29 | |
| 30 | class URITest(unittest.TestCase): |
| 31 | test_uris = { |
| 32 | "http://www.google.com/index.html" : { |
| 33 | 'uri': 'http://www.google.com/index.html', |
| 34 | 'scheme': 'http', |
| 35 | 'hostname': 'www.google.com', |
| 36 | 'port': None, |
| 37 | 'hostport': 'www.google.com', |
| 38 | 'path': '/index.html', |
| 39 | 'userinfo': '', |
| 40 | 'username': '', |
| 41 | 'password': '', |
| 42 | 'params': {}, |
| 43 | 'query': {}, |
| 44 | 'relative': False |
| 45 | }, |
| 46 | "http://www.google.com/index.html;param1=value1" : { |
| 47 | 'uri': 'http://www.google.com/index.html;param1=value1', |
| 48 | 'scheme': 'http', |
| 49 | 'hostname': 'www.google.com', |
| 50 | 'port': None, |
| 51 | 'hostport': 'www.google.com', |
| 52 | 'path': '/index.html', |
| 53 | 'userinfo': '', |
| 54 | 'username': '', |
| 55 | 'password': '', |
| 56 | 'params': { |
| 57 | 'param1': 'value1' |
| 58 | }, |
| 59 | 'query': {}, |
| 60 | 'relative': False |
| 61 | }, |
| 62 | "http://www.example.org/index.html?param1=value1" : { |
| 63 | 'uri': 'http://www.example.org/index.html?param1=value1', |
| 64 | 'scheme': 'http', |
| 65 | 'hostname': 'www.example.org', |
| 66 | 'port': None, |
| 67 | 'hostport': 'www.example.org', |
| 68 | 'path': '/index.html', |
| 69 | 'userinfo': '', |
| 70 | 'username': '', |
| 71 | 'password': '', |
| 72 | 'params': {}, |
| 73 | 'query': { |
| 74 | 'param1': 'value1' |
| 75 | }, |
| 76 | 'relative': False |
| 77 | }, |
| 78 | "http://www.example.org/index.html?qparam1=qvalue1;param2=value2" : { |
| 79 | 'uri': 'http://www.example.org/index.html?qparam1=qvalue1;param2=value2', |
| 80 | 'scheme': 'http', |
| 81 | 'hostname': 'www.example.org', |
| 82 | 'port': None, |
| 83 | 'hostport': 'www.example.org', |
| 84 | 'path': '/index.html', |
| 85 | 'userinfo': '', |
| 86 | 'username': '', |
| 87 | 'password': '', |
| 88 | 'params': { |
| 89 | 'param2': 'value2' |
| 90 | }, |
| 91 | 'query': { |
| 92 | 'qparam1': 'qvalue1' |
| 93 | }, |
| 94 | 'relative': False |
| 95 | }, |
| 96 | "http://www.example.com:8080/index.html" : { |
| 97 | 'uri': 'http://www.example.com:8080/index.html', |
| 98 | 'scheme': 'http', |
| 99 | 'hostname': 'www.example.com', |
| 100 | 'port': 8080, |
| 101 | 'hostport': 'www.example.com:8080', |
| 102 | 'path': '/index.html', |
| 103 | 'userinfo': '', |
| 104 | 'username': '', |
| 105 | 'password': '', |
| 106 | 'params': {}, |
| 107 | 'query': {}, |
| 108 | 'relative': False |
| 109 | }, |
| 110 | "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : { |
| 111 | 'uri': 'cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg', |
| 112 | 'scheme': 'cvs', |
| 113 | 'hostname': 'cvs.handhelds.org', |
| 114 | 'port': None, |
| 115 | 'hostport': 'cvs.handhelds.org', |
| 116 | 'path': '/cvs', |
| 117 | 'userinfo': 'anoncvs', |
| 118 | 'username': 'anoncvs', |
| 119 | 'password': '', |
| 120 | 'params': { |
| 121 | 'module': 'familiar/dist/ipkg' |
| 122 | }, |
| 123 | 'query': {}, |
| 124 | 'relative': False |
| 125 | }, |
| 126 | "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg": { |
| 127 | 'uri': 'cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg', |
| 128 | 'scheme': 'cvs', |
| 129 | 'hostname': 'cvs.handhelds.org', |
| 130 | 'port': None, |
| 131 | 'hostport': 'cvs.handhelds.org', |
| 132 | 'path': '/cvs', |
| 133 | 'userinfo': 'anoncvs:anonymous', |
| 134 | 'username': 'anoncvs', |
| 135 | 'password': 'anonymous', |
| 136 | 'params': { |
| 137 | 'tag': 'V0-99-81', |
| 138 | 'module': 'familiar/dist/ipkg' |
| 139 | }, |
| 140 | 'query': {}, |
| 141 | 'relative': False |
| 142 | }, |
| 143 | "file://example.diff": { # NOTE: Not RFC compliant! |
| 144 | 'uri': 'file:example.diff', |
| 145 | 'scheme': 'file', |
| 146 | 'hostname': '', |
| 147 | 'port': None, |
| 148 | 'hostport': '', |
| 149 | 'path': 'example.diff', |
| 150 | 'userinfo': '', |
| 151 | 'username': '', |
| 152 | 'password': '', |
| 153 | 'params': {}, |
| 154 | 'query': {}, |
| 155 | 'relative': True |
| 156 | }, |
| 157 | "file:example.diff": { # NOTE: RFC compliant version of the former |
| 158 | 'uri': 'file:example.diff', |
| 159 | 'scheme': 'file', |
| 160 | 'hostname': '', |
| 161 | 'port': None, |
| 162 | 'hostport': '', |
| 163 | 'path': 'example.diff', |
| 164 | 'userinfo': '', |
| 165 | 'userinfo': '', |
| 166 | 'username': '', |
| 167 | 'password': '', |
| 168 | 'params': {}, |
| 169 | 'query': {}, |
| 170 | 'relative': True |
| 171 | }, |
| 172 | "file:///tmp/example.diff": { |
| 173 | 'uri': 'file:///tmp/example.diff', |
| 174 | 'scheme': 'file', |
| 175 | 'hostname': '', |
| 176 | 'port': None, |
| 177 | 'hostport': '', |
| 178 | 'path': '/tmp/example.diff', |
| 179 | 'userinfo': '', |
| 180 | 'userinfo': '', |
| 181 | 'username': '', |
| 182 | 'password': '', |
| 183 | 'params': {}, |
| 184 | 'query': {}, |
| 185 | 'relative': False |
| 186 | }, |
| 187 | "git:///path/example.git": { |
| 188 | 'uri': 'git:///path/example.git', |
| 189 | 'scheme': 'git', |
| 190 | 'hostname': '', |
| 191 | 'port': None, |
| 192 | 'hostport': '', |
| 193 | 'path': '/path/example.git', |
| 194 | 'userinfo': '', |
| 195 | 'userinfo': '', |
| 196 | 'username': '', |
| 197 | 'password': '', |
| 198 | 'params': {}, |
| 199 | 'query': {}, |
| 200 | 'relative': False |
| 201 | }, |
| 202 | "git:path/example.git": { |
| 203 | 'uri': 'git:path/example.git', |
| 204 | 'scheme': 'git', |
| 205 | 'hostname': '', |
| 206 | 'port': None, |
| 207 | 'hostport': '', |
| 208 | 'path': 'path/example.git', |
| 209 | 'userinfo': '', |
| 210 | 'userinfo': '', |
| 211 | 'username': '', |
| 212 | 'password': '', |
| 213 | 'params': {}, |
| 214 | 'query': {}, |
| 215 | 'relative': True |
| 216 | }, |
| 217 | "git://example.net/path/example.git": { |
| 218 | 'uri': 'git://example.net/path/example.git', |
| 219 | 'scheme': 'git', |
| 220 | 'hostname': 'example.net', |
| 221 | 'port': None, |
| 222 | 'hostport': 'example.net', |
| 223 | 'path': '/path/example.git', |
| 224 | 'userinfo': '', |
| 225 | 'userinfo': '', |
| 226 | 'username': '', |
| 227 | 'password': '', |
| 228 | 'params': {}, |
| 229 | 'query': {}, |
| 230 | 'relative': False |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | def test_uri(self): |
| 235 | for test_uri, ref in self.test_uris.items(): |
| 236 | uri = URI(test_uri) |
| 237 | |
| 238 | self.assertEqual(str(uri), ref['uri']) |
| 239 | |
| 240 | # expected attributes |
| 241 | self.assertEqual(uri.scheme, ref['scheme']) |
| 242 | |
| 243 | self.assertEqual(uri.userinfo, ref['userinfo']) |
| 244 | self.assertEqual(uri.username, ref['username']) |
| 245 | self.assertEqual(uri.password, ref['password']) |
| 246 | |
| 247 | self.assertEqual(uri.hostname, ref['hostname']) |
| 248 | self.assertEqual(uri.port, ref['port']) |
| 249 | self.assertEqual(uri.hostport, ref['hostport']) |
| 250 | |
| 251 | self.assertEqual(uri.path, ref['path']) |
| 252 | self.assertEqual(uri.params, ref['params']) |
| 253 | |
| 254 | self.assertEqual(uri.relative, ref['relative']) |
| 255 | |
| 256 | def test_dict(self): |
| 257 | for test in self.test_uris.values(): |
| 258 | uri = URI() |
| 259 | |
| 260 | self.assertEqual(uri.scheme, '') |
| 261 | self.assertEqual(uri.userinfo, '') |
| 262 | self.assertEqual(uri.username, '') |
| 263 | self.assertEqual(uri.password, '') |
| 264 | self.assertEqual(uri.hostname, '') |
| 265 | self.assertEqual(uri.port, None) |
| 266 | self.assertEqual(uri.path, '') |
| 267 | self.assertEqual(uri.params, {}) |
| 268 | |
| 269 | |
| 270 | uri.scheme = test['scheme'] |
| 271 | self.assertEqual(uri.scheme, test['scheme']) |
| 272 | |
| 273 | uri.userinfo = test['userinfo'] |
| 274 | self.assertEqual(uri.userinfo, test['userinfo']) |
| 275 | self.assertEqual(uri.username, test['username']) |
| 276 | self.assertEqual(uri.password, test['password']) |
| 277 | |
| 278 | # make sure changing the values doesn't do anything unexpected |
| 279 | uri.username = 'changeme' |
| 280 | self.assertEqual(uri.username, 'changeme') |
| 281 | self.assertEqual(uri.password, test['password']) |
| 282 | uri.password = 'insecure' |
| 283 | self.assertEqual(uri.username, 'changeme') |
| 284 | self.assertEqual(uri.password, 'insecure') |
| 285 | |
| 286 | # reset back after our trickery |
| 287 | uri.userinfo = test['userinfo'] |
| 288 | self.assertEqual(uri.userinfo, test['userinfo']) |
| 289 | self.assertEqual(uri.username, test['username']) |
| 290 | self.assertEqual(uri.password, test['password']) |
| 291 | |
| 292 | uri.hostname = test['hostname'] |
| 293 | self.assertEqual(uri.hostname, test['hostname']) |
| 294 | self.assertEqual(uri.hostport, test['hostname']) |
| 295 | |
| 296 | uri.port = test['port'] |
| 297 | self.assertEqual(uri.port, test['port']) |
| 298 | self.assertEqual(uri.hostport, test['hostport']) |
| 299 | |
| 300 | uri.path = test['path'] |
| 301 | self.assertEqual(uri.path, test['path']) |
| 302 | |
| 303 | uri.params = test['params'] |
| 304 | self.assertEqual(uri.params, test['params']) |
| 305 | |
| 306 | uri.query = test['query'] |
| 307 | self.assertEqual(uri.query, test['query']) |
| 308 | |
| 309 | self.assertEqual(str(uri), test['uri']) |
| 310 | |
| 311 | uri.params = {} |
| 312 | self.assertEqual(uri.params, {}) |
| 313 | self.assertEqual(str(uri), (str(uri).split(";"))[0]) |
| 314 | |
| 315 | class FetcherTest(unittest.TestCase): |
| 316 | |
| 317 | def setUp(self): |
| 318 | self.origdir = os.getcwd() |
| 319 | self.d = bb.data.init() |
| 320 | self.tempdir = tempfile.mkdtemp() |
| 321 | self.dldir = os.path.join(self.tempdir, "download") |
| 322 | os.mkdir(self.dldir) |
| 323 | self.d.setVar("DL_DIR", self.dldir) |
| 324 | self.unpackdir = os.path.join(self.tempdir, "unpacked") |
| 325 | os.mkdir(self.unpackdir) |
| 326 | persistdir = os.path.join(self.tempdir, "persistdata") |
| 327 | self.d.setVar("PERSISTENT_DIR", persistdir) |
| 328 | |
| 329 | def tearDown(self): |
| 330 | os.chdir(self.origdir) |
| 331 | bb.utils.prunedir(self.tempdir) |
| 332 | |
| 333 | class MirrorUriTest(FetcherTest): |
| 334 | |
| 335 | replaceuris = { |
| 336 | ("git://git.invalid.infradead.org/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "http://somewhere.org/somedir/") |
| 337 | : "http://somewhere.org/somedir/git2_git.invalid.infradead.org.mtd-utils.git.tar.gz", |
| 338 | ("git://git.invalid.infradead.org/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/([^/]+/)*([^/]*)", "git://somewhere.org/somedir/\\2;protocol=http") |
| 339 | : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", |
| 340 | ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/([^/]+/)*([^/]*)", "git://somewhere.org/somedir/\\2;protocol=http") |
| 341 | : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", |
| 342 | ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/([^/]+/)*([^/]*)", "git://somewhere.org/\\2;protocol=http") |
| 343 | : "git://somewhere.org/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", |
| 344 | ("git://someserver.org/bitbake;tag=1234567890123456789012345678901234567890", "git://someserver.org/bitbake", "git://git.openembedded.org/bitbake") |
| 345 | : "git://git.openembedded.org/bitbake;tag=1234567890123456789012345678901234567890", |
| 346 | ("file://sstate-xyz.tgz", "file://.*", "file:///somewhere/1234/sstate-cache") |
| 347 | : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz", |
| 348 | ("file://sstate-xyz.tgz", "file://.*", "file:///somewhere/1234/sstate-cache/") |
| 349 | : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz", |
| 350 | ("http://somewhere.org/somedir1/somedir2/somefile_1.2.3.tar.gz", "http://.*/.*", "http://somewhere2.org/somedir3") |
| 351 | : "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz", |
| 352 | ("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz") |
| 353 | : "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz", |
| 354 | ("http://www.apache.org/dist/subversion/subversion-1.7.1.tar.bz2", "http://www.apache.org/dist", "http://archive.apache.org/dist") |
| 355 | : "http://archive.apache.org/dist/subversion/subversion-1.7.1.tar.bz2", |
| 356 | ("http://www.apache.org/dist/subversion/subversion-1.7.1.tar.bz2", "http://.*/.*", "file:///somepath/downloads/") |
| 357 | : "file:///somepath/downloads/subversion-1.7.1.tar.bz2", |
| 358 | ("git://git.invalid.infradead.org/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "git://somewhere.org/somedir/BASENAME;protocol=http") |
| 359 | : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", |
| 360 | ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "git://somewhere.org/somedir/BASENAME;protocol=http") |
| 361 | : "git://somewhere.org/somedir/mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", |
| 362 | ("git://git.invalid.infradead.org/foo/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "git://somewhere.org/somedir/MIRRORNAME;protocol=http") |
| 363 | : "git://somewhere.org/somedir/git.invalid.infradead.org.foo.mtd-utils.git;tag=1234567890123456789012345678901234567890;protocol=http", |
| 364 | |
| 365 | #Renaming files doesn't work |
| 366 | #("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz") : "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz" |
| 367 | #("file://sstate-xyz.tgz", "file://.*/.*", "file:///somewhere/1234/sstate-cache") : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz", |
| 368 | } |
| 369 | |
| 370 | mirrorvar = "http://.*/.* file:///somepath/downloads/ \n" \ |
| 371 | "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n" \ |
| 372 | "https://.*/.* file:///someotherpath/downloads/ \n" \ |
| 373 | "http://.*/.* file:///someotherpath/downloads/ \n" |
| 374 | |
| 375 | def test_urireplace(self): |
| 376 | for k, v in self.replaceuris.items(): |
| 377 | ud = bb.fetch.FetchData(k[0], self.d) |
| 378 | ud.setup_localpath(self.d) |
| 379 | mirrors = bb.fetch2.mirror_from_string("%s %s" % (k[1], k[2])) |
| 380 | newuris, uds = bb.fetch2.build_mirroruris(ud, mirrors, self.d) |
| 381 | self.assertEqual([v], newuris) |
| 382 | |
| 383 | def test_urilist1(self): |
| 384 | fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) |
| 385 | mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) |
| 386 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) |
| 387 | self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz']) |
| 388 | |
| 389 | def test_urilist2(self): |
| 390 | # Catch https:// -> files:// bug |
| 391 | fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) |
| 392 | mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) |
| 393 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) |
| 394 | self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) |
| 395 | |
| 396 | def test_mirror_of_mirror(self): |
| 397 | # Test if mirror of a mirror works |
| 398 | mirrorvar = self.mirrorvar + " http://.*/.* http://otherdownloads.yoctoproject.org/downloads/ \n" |
| 399 | mirrorvar = mirrorvar + " http://otherdownloads.yoctoproject.org/.* http://downloads2.yoctoproject.org/downloads/ \n" |
| 400 | fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) |
| 401 | mirrors = bb.fetch2.mirror_from_string(mirrorvar) |
| 402 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) |
| 403 | self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', |
| 404 | 'file:///someotherpath/downloads/bitbake-1.0.tar.gz', |
| 405 | 'http://otherdownloads.yoctoproject.org/downloads/bitbake-1.0.tar.gz', |
| 406 | 'http://downloads2.yoctoproject.org/downloads/bitbake-1.0.tar.gz']) |
| 407 | |
Patrick Williams | d7e9631 | 2015-09-22 08:09:05 -0500 | [diff] [blame] | 408 | recmirrorvar = "https://.*/[^/]* http://AAAA/A/A/A/ \n" \ |
| 409 | "https://.*/[^/]* https://BBBB/B/B/B/ \n" |
| 410 | |
| 411 | def test_recursive(self): |
| 412 | fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) |
| 413 | mirrors = bb.fetch2.mirror_from_string(self.recmirrorvar) |
| 414 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) |
| 415 | self.assertEqual(uris, ['http://AAAA/A/A/A/bitbake/bitbake-1.0.tar.gz', |
| 416 | 'https://BBBB/B/B/B/bitbake/bitbake-1.0.tar.gz', |
| 417 | 'http://AAAA/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz']) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 418 | |
| 419 | class FetcherLocalTest(FetcherTest): |
| 420 | def setUp(self): |
| 421 | def touch(fn): |
| 422 | with file(fn, 'a'): |
| 423 | os.utime(fn, None) |
| 424 | |
| 425 | super(FetcherLocalTest, self).setUp() |
| 426 | self.localsrcdir = os.path.join(self.tempdir, 'localsrc') |
| 427 | os.makedirs(self.localsrcdir) |
| 428 | touch(os.path.join(self.localsrcdir, 'a')) |
| 429 | touch(os.path.join(self.localsrcdir, 'b')) |
| 430 | os.makedirs(os.path.join(self.localsrcdir, 'dir')) |
| 431 | touch(os.path.join(self.localsrcdir, 'dir', 'c')) |
| 432 | touch(os.path.join(self.localsrcdir, 'dir', 'd')) |
| 433 | os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir')) |
| 434 | touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e')) |
| 435 | self.d.setVar("FILESPATH", self.localsrcdir) |
| 436 | |
| 437 | def fetchUnpack(self, uris): |
| 438 | fetcher = bb.fetch.Fetch(uris, self.d) |
| 439 | fetcher.download() |
| 440 | fetcher.unpack(self.unpackdir) |
| 441 | flst = [] |
| 442 | for root, dirs, files in os.walk(self.unpackdir): |
| 443 | for f in files: |
| 444 | flst.append(os.path.relpath(os.path.join(root, f), self.unpackdir)) |
| 445 | flst.sort() |
| 446 | return flst |
| 447 | |
| 448 | def test_local(self): |
| 449 | tree = self.fetchUnpack(['file://a', 'file://dir/c']) |
| 450 | self.assertEqual(tree, ['a', 'dir/c']) |
| 451 | |
| 452 | def test_local_wildcard(self): |
| 453 | tree = self.fetchUnpack(['file://a', 'file://dir/*']) |
| 454 | # FIXME: this is broken - it should return ['a', 'dir/c', 'dir/d', 'dir/subdir/e'] |
| 455 | # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=6128 |
| 456 | self.assertEqual(tree, ['a', 'b', 'dir/c', 'dir/d', 'dir/subdir/e']) |
| 457 | |
| 458 | def test_local_dir(self): |
| 459 | tree = self.fetchUnpack(['file://a', 'file://dir']) |
| 460 | self.assertEqual(tree, ['a', 'dir/c', 'dir/d', 'dir/subdir/e']) |
| 461 | |
| 462 | def test_local_subdir(self): |
| 463 | tree = self.fetchUnpack(['file://dir/subdir']) |
| 464 | # FIXME: this is broken - it should return ['dir/subdir/e'] |
| 465 | # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=6129 |
| 466 | self.assertEqual(tree, ['subdir/e']) |
| 467 | |
| 468 | def test_local_subdir_file(self): |
| 469 | tree = self.fetchUnpack(['file://dir/subdir/e']) |
| 470 | self.assertEqual(tree, ['dir/subdir/e']) |
| 471 | |
| 472 | def test_local_subdirparam(self): |
| 473 | tree = self.fetchUnpack(['file://a;subdir=bar']) |
| 474 | self.assertEqual(tree, ['bar/a']) |
| 475 | |
| 476 | def test_local_deepsubdirparam(self): |
| 477 | tree = self.fetchUnpack(['file://dir/subdir/e;subdir=bar']) |
| 478 | self.assertEqual(tree, ['bar/dir/subdir/e']) |
| 479 | |
| 480 | class FetcherNetworkTest(FetcherTest): |
| 481 | |
| 482 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": |
| 483 | print("Unset BB_SKIP_NETTESTS to run network tests") |
| 484 | else: |
| 485 | def test_fetch(self): |
| 486 | fetcher = bb.fetch.Fetch(["http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d) |
| 487 | fetcher.download() |
| 488 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) |
| 489 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.1.tar.gz"), 57892) |
| 490 | self.d.setVar("BB_NO_NETWORK", "1") |
| 491 | fetcher = bb.fetch.Fetch(["http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d) |
| 492 | fetcher.download() |
| 493 | fetcher.unpack(self.unpackdir) |
| 494 | self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9) |
| 495 | self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.1/")), 9) |
| 496 | |
| 497 | def test_fetch_mirror(self): |
| 498 | self.d.setVar("MIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake") |
| 499 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) |
| 500 | fetcher.download() |
| 501 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) |
| 502 | |
| 503 | def test_fetch_mirror_of_mirror(self): |
| 504 | self.d.setVar("MIRRORS", "http://.*/.* http://invalid2.yoctoproject.org/ \n http://invalid2.yoctoproject.org/.* http://downloads.yoctoproject.org/releases/bitbake") |
| 505 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) |
| 506 | fetcher.download() |
| 507 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) |
| 508 | |
| 509 | def test_fetch_file_mirror_of_mirror(self): |
| 510 | self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ \n file:///some1where/.* file://some2where/ \n file://some2where/.* http://downloads.yoctoproject.org/releases/bitbake") |
| 511 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) |
| 512 | os.mkdir(self.dldir + "/some2where") |
| 513 | fetcher.download() |
| 514 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) |
| 515 | |
| 516 | def test_fetch_premirror(self): |
| 517 | self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake") |
| 518 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) |
| 519 | fetcher.download() |
| 520 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) |
| 521 | |
| 522 | def gitfetcher(self, url1, url2): |
| 523 | def checkrevision(self, fetcher): |
| 524 | fetcher.unpack(self.unpackdir) |
| 525 | revision = bb.process.run("git rev-parse HEAD", shell=True, cwd=self.unpackdir + "/git")[0].strip() |
| 526 | self.assertEqual(revision, "270a05b0b4ba0959fe0624d2a4885d7b70426da5") |
| 527 | |
| 528 | self.d.setVar("BB_GENERATE_MIRROR_TARBALLS", "1") |
| 529 | self.d.setVar("SRCREV", "270a05b0b4ba0959fe0624d2a4885d7b70426da5") |
| 530 | fetcher = bb.fetch.Fetch([url1], self.d) |
| 531 | fetcher.download() |
| 532 | checkrevision(self, fetcher) |
| 533 | # Wipe out the dldir clone and the unpacked source, turn off the network and check mirror tarball works |
| 534 | bb.utils.prunedir(self.dldir + "/git2/") |
| 535 | bb.utils.prunedir(self.unpackdir) |
| 536 | self.d.setVar("BB_NO_NETWORK", "1") |
| 537 | fetcher = bb.fetch.Fetch([url2], self.d) |
| 538 | fetcher.download() |
| 539 | checkrevision(self, fetcher) |
| 540 | |
| 541 | def test_gitfetch(self): |
| 542 | url1 = url2 = "git://git.openembedded.org/bitbake" |
| 543 | self.gitfetcher(url1, url2) |
| 544 | |
| 545 | def test_gitfetch_goodsrcrev(self): |
| 546 | # SRCREV is set but matches rev= parameter |
| 547 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=270a05b0b4ba0959fe0624d2a4885d7b70426da5" |
| 548 | self.gitfetcher(url1, url2) |
| 549 | |
| 550 | def test_gitfetch_badsrcrev(self): |
| 551 | # SRCREV is set but does not match rev= parameter |
| 552 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=dead05b0b4ba0959fe0624d2a4885d7b70426da5" |
| 553 | self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2) |
| 554 | |
| 555 | def test_gitfetch_tagandrev(self): |
| 556 | # SRCREV is set but does not match rev= parameter |
| 557 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=270a05b0b4ba0959fe0624d2a4885d7b70426da5;tag=270a05b0b4ba0959fe0624d2a4885d7b70426da5" |
| 558 | self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2) |
| 559 | |
| 560 | def test_gitfetch_premirror(self): |
| 561 | url1 = "git://git.openembedded.org/bitbake" |
| 562 | url2 = "git://someserver.org/bitbake" |
| 563 | self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") |
| 564 | self.gitfetcher(url1, url2) |
| 565 | |
| 566 | def test_gitfetch_premirror2(self): |
| 567 | url1 = url2 = "git://someserver.org/bitbake" |
| 568 | self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") |
| 569 | self.gitfetcher(url1, url2) |
| 570 | |
| 571 | def test_gitfetch_premirror3(self): |
| 572 | realurl = "git://git.openembedded.org/bitbake" |
| 573 | dummyurl = "git://someserver.org/bitbake" |
| 574 | self.sourcedir = self.unpackdir.replace("unpacked", "sourcemirror.git") |
| 575 | os.chdir(self.tempdir) |
| 576 | bb.process.run("git clone %s %s 2> /dev/null" % (realurl, self.sourcedir), shell=True) |
| 577 | self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file \n" % (dummyurl, self.sourcedir)) |
| 578 | self.gitfetcher(dummyurl, dummyurl) |
| 579 | |
| 580 | def test_git_submodule(self): |
| 581 | fetcher = bb.fetch.Fetch(["gitsm://git.yoctoproject.org/git-submodule-test;rev=f12e57f2edf0aa534cf1616fa983d165a92b0842"], self.d) |
| 582 | fetcher.download() |
| 583 | # Previous cwd has been deleted |
| 584 | os.chdir(os.path.dirname(self.unpackdir)) |
| 585 | fetcher.unpack(self.unpackdir) |
| 586 | |
| 587 | def test_trusted_network(self): |
| 588 | # Ensure trusted_network returns False when the host IS in the list. |
| 589 | url = "git://Someserver.org/foo;rev=1" |
| 590 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org someserver.org server2.org server3.org") |
| 591 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) |
| 592 | |
| 593 | def test_wild_trusted_network(self): |
| 594 | # Ensure trusted_network returns true when the *.host IS in the list. |
| 595 | url = "git://Someserver.org/foo;rev=1" |
| 596 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org") |
| 597 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) |
| 598 | |
| 599 | def test_prefix_wild_trusted_network(self): |
| 600 | # Ensure trusted_network returns true when the prefix matches *.host. |
| 601 | url = "git://git.Someserver.org/foo;rev=1" |
| 602 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org") |
| 603 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) |
| 604 | |
| 605 | def test_two_prefix_wild_trusted_network(self): |
| 606 | # Ensure trusted_network returns true when the prefix matches *.host. |
| 607 | url = "git://something.git.Someserver.org/foo;rev=1" |
| 608 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org") |
| 609 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) |
| 610 | |
| 611 | def test_untrusted_network(self): |
| 612 | # Ensure trusted_network returns False when the host is NOT in the list. |
| 613 | url = "git://someserver.org/foo;rev=1" |
| 614 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org") |
| 615 | self.assertFalse(bb.fetch.trusted_network(self.d, url)) |
| 616 | |
| 617 | def test_wild_untrusted_network(self): |
| 618 | # Ensure trusted_network returns False when the host is NOT in the list. |
| 619 | url = "git://*.someserver.org/foo;rev=1" |
| 620 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org") |
| 621 | self.assertFalse(bb.fetch.trusted_network(self.d, url)) |
| 622 | |
| 623 | |
| 624 | class URLHandle(unittest.TestCase): |
| 625 | |
| 626 | datatable = { |
| 627 | "http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}), |
| 628 | "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}), |
| 629 | "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'}), |
| 630 | "git://git.openembedded.org/bitbake;branch=@foo" : ('git', 'git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'}) |
| 631 | } |
| 632 | |
| 633 | def test_decodeurl(self): |
| 634 | for k, v in self.datatable.items(): |
| 635 | result = bb.fetch.decodeurl(k) |
| 636 | self.assertEqual(result, v) |
| 637 | |
| 638 | def test_encodeurl(self): |
| 639 | for k, v in self.datatable.items(): |
| 640 | result = bb.fetch.encodeurl(v) |
| 641 | self.assertEqual(result, k) |
| 642 | |
| 643 | class FetchLatestVersionTest(FetcherTest): |
| 644 | |
| 645 | test_git_uris = { |
| 646 | # version pattern "X.Y.Z" |
| 647 | ("mx-1.0", "git://github.com/clutter-project/mx.git;branch=mx-1.4", "9b1db6b8060bd00b121a692f942404a24ae2960f", "") |
| 648 | : "1.99.4", |
| 649 | # version pattern "vX.Y" |
| 650 | ("mtd-utils", "git://git.infradead.org/mtd-utils.git", "ca39eb1d98e736109c64ff9c1aa2a6ecca222d8f", "") |
| 651 | : "1.5.0", |
| 652 | # version pattern "pkg_name-X.Y" |
| 653 | ("presentproto", "git://anongit.freedesktop.org/git/xorg/proto/presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "") |
| 654 | : "1.0", |
| 655 | # version pattern "pkg_name-vX.Y.Z" |
| 656 | ("dtc", "git://git.qemu.org/dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "") |
| 657 | : "1.4.0", |
| 658 | # combination version pattern |
| 659 | ("sysprof", "git://git.gnome.org/sysprof", "cd44ee6644c3641507fb53b8a2a69137f2971219", "") |
| 660 | : "1.2.0", |
| 661 | ("u-boot-mkimage", "git://git.denx.de/u-boot.git;branch=master;protocol=git", "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c", "") |
| 662 | : "2014.01", |
| 663 | # version pattern "yyyymmdd" |
| 664 | ("mobile-broadband-provider-info", "git://git.gnome.org/mobile-broadband-provider-info", "4ed19e11c2975105b71b956440acdb25d46a347d", "") |
| 665 | : "20120614", |
| 666 | # packages with a valid GITTAGREGEX |
| 667 | ("xf86-video-omap", "git://anongit.freedesktop.org/xorg/driver/xf86-video-omap", "ae0394e687f1a77e966cf72f895da91840dffb8f", "(?P<pver>(\d+\.(\d\.?)*))") |
| 668 | : "0.4.3", |
| 669 | ("build-appliance-image", "git://git.yoctoproject.org/poky", "b37dd451a52622d5b570183a81583cc34c2ff555", "(?P<pver>(([0-9][\.|_]?)+[0-9]))") |
| 670 | : "11.0.0", |
| 671 | ("chkconfig-alternatives-native", "git://github.com/kergoth/chkconfig;branch=sysroot", "cd437ecbd8986c894442f8fce1e0061e20f04dee", "chkconfig\-(?P<pver>((\d+[\.\-_]*)+))") |
| 672 | : "1.3.59", |
| 673 | ("remake", "git://github.com/rocky/remake.git", "f05508e521987c8494c92d9c2871aec46307d51d", "(?P<pver>(\d+\.(\d+\.)*\d*(\+dbg\d+(\.\d+)*)*))") |
| 674 | : "3.82+dbg0.9", |
| 675 | } |
| 676 | |
| 677 | test_wget_uris = { |
| 678 | # packages with versions inside directory name |
| 679 | ("util-linux", "http://kernel.org/pub/linux/utils/util-linux/v2.23/util-linux-2.24.2.tar.bz2", "", "") |
| 680 | : "2.24.2", |
| 681 | ("enchant", "http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz", "", "") |
| 682 | : "1.6.0", |
| 683 | ("cmake", "http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz", "", "") |
| 684 | : "2.8.12.1", |
| 685 | # packages with versions only in current directory |
| 686 | ("eglic", "http://downloads.yoctoproject.org/releases/eglibc/eglibc-2.18-svnr23787.tar.bz2", "", "") |
| 687 | : "2.19", |
| 688 | ("gnu-config", "http://downloads.yoctoproject.org/releases/gnu-config/gnu-config-20120814.tar.bz2", "", "") |
| 689 | : "20120814", |
| 690 | # packages with "99" in the name of possible version |
| 691 | ("pulseaudio", "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-4.0.tar.xz", "", "") |
| 692 | : "5.0", |
| 693 | ("xserver-xorg", "http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.15.1.tar.bz2", "", "") |
| 694 | : "1.15.1", |
| 695 | # packages with valid REGEX_URI and REGEX |
| 696 | ("cups", "http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2", "http://www.cups.org/software.php", "(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz") |
| 697 | : "2.0.0", |
| 698 | ("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html", "http://download.oracle.com/otn/berkeley-db/(?P<name>db-)(?P<pver>((\d+[\.\-_]*)+))\.tar\.gz") |
| 699 | : "6.1.19", |
| 700 | } |
| 701 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": |
| 702 | print("Unset BB_SKIP_NETTESTS to run network tests") |
| 703 | else: |
| 704 | def test_git_latest_versionstring(self): |
| 705 | for k, v in self.test_git_uris.items(): |
| 706 | self.d.setVar("PN", k[0]) |
| 707 | self.d.setVar("SRCREV", k[2]) |
| 708 | self.d.setVar("GITTAGREGEX", k[3]) |
| 709 | ud = bb.fetch2.FetchData(k[1], self.d) |
| 710 | pupver= ud.method.latest_versionstring(ud, self.d) |
| 711 | verstring = pupver[0] |
| 712 | r = bb.utils.vercmp_string(v, verstring) |
| 713 | self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) |
| 714 | |
| 715 | def test_wget_latest_versionstring(self): |
| 716 | for k, v in self.test_wget_uris.items(): |
| 717 | self.d.setVar("PN", k[0]) |
| 718 | self.d.setVar("REGEX_URI", k[2]) |
| 719 | self.d.setVar("REGEX", k[3]) |
| 720 | ud = bb.fetch2.FetchData(k[1], self.d) |
| 721 | pupver = ud.method.latest_versionstring(ud, self.d) |
| 722 | verstring = pupver[0] |
| 723 | r = bb.utils.vercmp_string(v, verstring) |
| 724 | self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) |
| 725 | |
| 726 | |
| 727 | class FetchCheckStatusTest(FetcherTest): |
| 728 | test_wget_uris = ["http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2", |
| 729 | "http://www.cups.org/software/ipptool/ipptool-20130731-linux-ubuntu-i686.tar.gz", |
| 730 | "http://www.cups.org/", |
| 731 | "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.1.tar.gz", |
| 732 | "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.2.tar.gz", |
| 733 | "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.3.tar.gz", |
| 734 | "https://yoctoproject.org/", |
| 735 | "https://yoctoproject.org/documentation", |
| 736 | "http://downloads.yoctoproject.org/releases/opkg/opkg-0.1.7.tar.gz", |
| 737 | "http://downloads.yoctoproject.org/releases/opkg/opkg-0.3.0.tar.gz", |
| 738 | "ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz", |
| 739 | "ftp://ftp.gnu.org/gnu/chess/gnuchess-5.08.tar.gz", |
| 740 | "ftp://ftp.gnu.org/gnu/gmp/gmp-4.0.tar.gz", |
| 741 | ] |
| 742 | |
| 743 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": |
| 744 | print("Unset BB_SKIP_NETTESTS to run network tests") |
| 745 | else: |
| 746 | |
| 747 | def test_wget_checkstatus(self): |
| 748 | fetch = bb.fetch2.Fetch(self.test_wget_uris, self.d) |
| 749 | for u in self.test_wget_uris: |
| 750 | ud = fetch.ud[u] |
| 751 | m = ud.method |
| 752 | ret = m.checkstatus(fetch, ud, self.d) |
| 753 | self.assertTrue(ret, msg="URI %s, can't check status" % (u)) |
| 754 | |
| 755 | |
| 756 | def test_wget_checkstatus_connection_cache(self): |
| 757 | from bb.fetch2 import FetchConnectionCache |
| 758 | |
| 759 | connection_cache = FetchConnectionCache() |
| 760 | fetch = bb.fetch2.Fetch(self.test_wget_uris, self.d, |
| 761 | connection_cache = connection_cache) |
| 762 | |
| 763 | for u in self.test_wget_uris: |
| 764 | ud = fetch.ud[u] |
| 765 | m = ud.method |
| 766 | ret = m.checkstatus(fetch, ud, self.d) |
| 767 | self.assertTrue(ret, msg="URI %s, can't check status" % (u)) |
| 768 | |
| 769 | connection_cache.close_connections() |