[bitbake-devel] [PATCH 1/9] fetch2/git: add tests to verify naming of download directories
Urs Fässler
urs.fassler at bbv.ch
Mon Jul 23 15:42:51 UTC 2018
The mapping of the URLs to the local directory is not obvious. For easier
understanding, we add this tests to explicit showing the mapping.
Signed-off-by: Urs Fässler <urs.fassler at bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach at siemens.com>
---
lib/bb/tests/fetch.py | 52 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 4af0ac55..5bce1bf8 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -463,6 +463,58 @@ class MirrorUriTest(FetcherTest):
'https://BBBB/B/B/B/bitbake/bitbake-1.0.tar.gz',
'http://AAAA/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz'])
+
+class GitDownloadDirectoryNamingTest(FetcherTest):
+ def setUp(self):
+ super(GitDownloadDirectoryNamingTest, self).setUp()
+ self.__recipe_url = "git://git.openembedded.org/bitbake"
+ self.__recipe_dir = "git.openembedded.org.bitbake"
+ self.__mirror_url = "git://github.com/openembedded/bitbake.git"
+ self.__mirror_dir = "github.com.openembedded.bitbake.git"
+
+ self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
+ self.d.setVar("PREMIRRORS", self.__recipe_url + " " + self.__mirror_url + " \n")
+
+ @skipIfNoNetwork()
+ def test_that_directory_is_named_after_recipe_url_when_no_mirroring_is_used(self):
+ fetcher = bb.fetch.Fetch([self.__mirror_url], self.d)
+
+ fetcher.download()
+
+ dir = os.listdir(self.dldir + "/git2")
+ self.assertIn(self.__mirror_dir, dir)
+
+ @skipIfNoNetwork()
+ def test_that_directory_exists_for_mirrored_url_and_recipe_url_when_mirroring_is_used(self):
+ fetcher = bb.fetch.Fetch([self.__recipe_url], self.d)
+
+ fetcher.download()
+
+ dir = os.listdir(self.dldir + "/git2")
+ self.assertIn(self.__mirror_dir, dir)
+ self.assertIn(self.__recipe_dir, dir)
+
+ @skipIfNoNetwork()
+ def test_that_recipe_directory_is_link_to_mirrored_directory_when_mirroring_is_used(self):
+ fetcher = bb.fetch.Fetch([self.__recipe_url], self.d)
+
+ fetcher.download()
+
+ path = os.readlink(self.dldir + "/git2/" + self.__recipe_dir)
+ self.assertTrue(path.endswith("/" + self.__mirror_dir))
+
+ @skipIfNoNetwork()
+ def test_that_recipe_directory_is_link_to_mirrored_directory_when_mirroring_is_used_and_the_mirrored_directory_already_exists(self):
+ fetcher = bb.fetch.Fetch([self.__mirror_url], self.d)
+ fetcher.download()
+ fetcher = bb.fetch.Fetch([self.__recipe_url], self.d)
+
+ fetcher.download()
+
+ path = os.readlink(self.dldir + "/git2/" + self.__recipe_dir)
+ self.assertTrue(path.endswith("/" + self.__mirror_dir))
+
+
class FetcherLocalTest(FetcherTest):
def setUp(self):
def touch(fn):
--
2.18.0
More information about the bitbake-devel
mailing list