summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-15 18:01:27 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-16 22:31:51 +0100
commit71626c1b94b87d0f3996efedb5735d80d157adde (patch)
treec5215f9118ec0cfdc8e61930fe05345dd4a339c7 /bitbake/lib/bb/tests
parent2be227190625ed868f5be08aac26665566a623cc (diff)
downloadpoky-71626c1b94b87d0f3996efedb5735d80d157adde.tar.gz
bitbake: tests/fetch: Add mirror of mirror tests
Add some tests of mirrors or mirrors to the fetcher unittests. (Bitbake rev: e33d82bc10283d533f928836d56a6f0af80ea5c1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/fetch.py25
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
397class FetcherLocalTest(FetcherTest): 409class 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)