diff options
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 3575468e57..561650e185 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -393,6 +393,18 @@ class MirrorUriTest(FetcherTest): | |||
393 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) | 393 | uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) |
394 | self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) | 394 | self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) |
395 | 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 | |||
396 | 408 | ||
397 | class FetcherLocalTest(FetcherTest): | 409 | class FetcherLocalTest(FetcherTest): |
398 | def setUp(self): | 410 | def setUp(self): |
@@ -478,6 +490,19 @@ class FetcherNetworkTest(FetcherTest): | |||
478 | fetcher.download() | 490 | fetcher.download() |
479 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) | 491 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) |
480 | 492 | ||
493 | def test_fetch_mirror_of_mirror(self): | ||
494 | self.d.setVar("MIRRORS", "http://.*/.* http://invalid2.yoctoproject.org/ \n http://invalid2.yoctoproject.org/.* http://downloads.yoctoproject.org/releases/bitbake") | ||
495 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) | ||
496 | fetcher.download() | ||
497 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) | ||
498 | |||
499 | def test_fetch_file_mirror_of_mirror(self): | ||
500 | self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ \n file:///some1where/.* file://some2where/ \n file://some2where/.* http://downloads.yoctoproject.org/releases/bitbake") | ||
501 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) | ||
502 | os.mkdir(self.dldir + "/some2where") | ||
503 | fetcher.download() | ||
504 | self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) | ||
505 | |||
481 | def test_fetch_premirror(self): | 506 | def test_fetch_premirror(self): |
482 | self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake") | 507 | self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake") |
483 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) | 508 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) |