summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUrs Fässler <urs.fassler@bbv.ch>2018-10-15 13:43:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-18 10:59:26 +0100
commitffac9c20f5b8bb084bdac2888ea5df6bc5e58684 (patch)
tree9ec7ed17eb4f0814ff4582744d27e8686452d0cd
parent212cbc038270bc12e239e9e3b0da3a173a698c77 (diff)
downloadpoky-ffac9c20f5b8bb084bdac2888ea5df6bc5e58684.tar.gz
bitbake: fetch2/git: add tests to capture existing behavior wrt. naming of clone directories
The mapping of the URLs to the local directory is not obvious. For easier understanding, we add this tests to explicitly showing the mapping. (Bitbake rev: 5f92682389fee437d6df2ff7718c571b7444e179) Signed-off-by: Urs Fässler <urs.fassler@bbv.ch> Signed-off-by: Pascal Bach <pascal.bach@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/tests/fetch.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index ff66315aa5..5359531282 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -463,6 +463,55 @@ class MirrorUriTest(FetcherTest):
463 'https://BBBB/B/B/B/bitbake/bitbake-1.0.tar.gz', 463 'https://BBBB/B/B/B/bitbake/bitbake-1.0.tar.gz',
464 'http://AAAA/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz']) 464 'http://AAAA/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz'])
465 465
466
467class GitDownloadDirectoryNamingTest(FetcherTest):
468 def setUp(self):
469 super(GitDownloadDirectoryNamingTest, self).setUp()
470 self.recipe_url = "git://git.openembedded.org/bitbake"
471 self.recipe_dir = "git.openembedded.org.bitbake"
472 self.mirror_url = "git://github.com/openembedded/bitbake.git"
473 self.mirror_dir = "github.com.openembedded.bitbake.git"
474
475 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
476
477 def setup_mirror_rewrite(self):
478 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url + " \n")
479
480 @skipIfNoNetwork()
481 def test_that_directory_is_named_after_recipe_url_when_no_mirroring_is_used(self):
482 self.setup_mirror_rewrite()
483 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
484
485 fetcher.download()
486
487 dir = os.listdir(self.dldir + "/git2")
488 self.assertIn(self.recipe_dir, dir)
489
490 @skipIfNoNetwork()
491 def test_that_directory_exists_for_mirrored_url_and_recipe_url_when_mirroring_is_used(self):
492 self.setup_mirror_rewrite()
493 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
494
495 fetcher.download()
496
497 dir = os.listdir(self.dldir + "/git2")
498 self.assertIn(self.mirror_dir, dir)
499 self.assertIn(self.recipe_dir, dir)
500
501 @skipIfNoNetwork()
502 def test_that_recipe_directory_and_mirrored_directory_exists_when_mirroring_is_used_and_the_mirrored_directory_already_exists(self):
503 self.setup_mirror_rewrite()
504 fetcher = bb.fetch.Fetch([self.mirror_url], self.d)
505 fetcher.download()
506 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
507
508 fetcher.download()
509
510 dir = os.listdir(self.dldir + "/git2")
511 self.assertIn(self.mirror_dir, dir)
512 self.assertIn(self.recipe_dir, dir)
513
514
466class FetcherLocalTest(FetcherTest): 515class FetcherLocalTest(FetcherTest):
467 def setUp(self): 516 def setUp(self):
468 def touch(fn): 517 def touch(fn):