diff options
Diffstat (limited to 'poky/bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | poky/bitbake/lib/bb/tests/fetch.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/poky/bitbake/lib/bb/tests/fetch.py b/poky/bitbake/lib/bb/tests/fetch.py index 532adb9414..d230120271 100644 --- a/poky/bitbake/lib/bb/tests/fetch.py +++ b/poky/bitbake/lib/bb/tests/fetch.py @@ -424,6 +424,10 @@ class FetcherTest(unittest.TestCase): def git_init(self, cwd=None): self.git('init', cwd=cwd) + # Explicitly set initial branch to master as + # a common setup is to use other default + # branch than master. + self.git(['checkout', '-b', 'master'], cwd=cwd) if not self.git(['config', 'user.email'], cwd=cwd): self.git(['config', 'user.email', 'you@example.com'], cwd=cwd) if not self.git(['config', 'user.name'], cwd=cwd): @@ -2392,6 +2396,31 @@ class CrateTest(FetcherTest): self.assertTrue(os.path.exists(self.tempdir + "/cargo_home/bitbake/glob-0.2.11/src/lib.rs")) @skipIfNoNetwork() + def test_crate_url_matching_recipe(self): + + self.d.setVar('BP', 'glob-0.2.11') + + uri = "crate://crates.io/glob/0.2.11" + self.d.setVar('SRC_URI', uri) + + uris = self.d.getVar('SRC_URI').split() + d = self.d + + fetcher = bb.fetch2.Fetch(uris, self.d) + ud = fetcher.ud[fetcher.urls[0]] + + self.assertIn("name", ud.parm) + self.assertEqual(ud.parm["name"], "glob-0.2.11") + self.assertIn("downloadfilename", ud.parm) + self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate") + + fetcher.download() + fetcher.unpack(self.tempdir) + self.assertEqual(sorted(os.listdir(self.tempdir)), ['download', 'glob-0.2.11', 'unpacked']) + self.assertEqual(sorted(os.listdir(self.tempdir + "/download")), ['glob-0.2.11.crate', 'glob-0.2.11.crate.done']) + self.assertTrue(os.path.exists(self.tempdir + "/glob-0.2.11/src/lib.rs")) + + @skipIfNoNetwork() def test_crate_url_params(self): uri = "crate://crates.io/aho-corasick/0.7.20;name=aho-corasick-renamed" |