diff options
| author | Joey Degges <jdegges@gmail.com> | 2021-01-04 21:14:55 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-01-08 10:11:42 +0000 |
| commit | 41ed881feaca7248426b60053aef41a2ce0eb39e (patch) | |
| tree | b14fdf23b6d4e6768e9fcfcbb0554ec587d9726d /bitbake/lib/bb/tests/fetch.py | |
| parent | d5c4cd6a0b50c87a686c9e560f1b4d7c4446bc1e (diff) | |
| download | poky-41ed881feaca7248426b60053aef41a2ce0eb39e.tar.gz | |
bitbake: tests/fetch: Test usehead with a non-default name
Add tests for fetching a URL with the usehead parameter set and a
non-default name set. We currently expect the local version of this test
to fail since there is a bug in the usehead implementation that breaks
for non-default names.
(Bitbake rev: a2345110f217fac429f6ec15f699c87c39531e7c)
Signed-off-by: Joey Degges <jdegges@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 971c613ddd..64cc9fa76b 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -680,6 +680,38 @@ class FetcherLocalTest(FetcherTest): | |||
| 680 | unpack_rev = stdout[0].strip() | 680 | unpack_rev = stdout[0].strip() |
| 681 | self.assertEqual(orig_rev, unpack_rev) | 681 | self.assertEqual(orig_rev, unpack_rev) |
| 682 | 682 | ||
| 683 | def test_local_gitfetch_usehead_withname(self): | ||
| 684 | # Create dummy local Git repo | ||
| 685 | src_dir = tempfile.mkdtemp(dir=self.tempdir, | ||
| 686 | prefix='gitfetch_localusehead_') | ||
| 687 | src_dir = os.path.abspath(src_dir) | ||
| 688 | bb.process.run("git init", cwd=src_dir) | ||
| 689 | bb.process.run("git commit --allow-empty -m'Dummy commit'", | ||
| 690 | cwd=src_dir) | ||
| 691 | # Use other branch than master | ||
| 692 | bb.process.run("git checkout -b my-devel", cwd=src_dir) | ||
| 693 | bb.process.run("git commit --allow-empty -m'Dummy commit 2'", | ||
| 694 | cwd=src_dir) | ||
| 695 | stdout = bb.process.run("git rev-parse HEAD", cwd=src_dir) | ||
| 696 | orig_rev = stdout[0].strip() | ||
| 697 | |||
| 698 | # Fetch and check revision | ||
| 699 | self.d.setVar("SRCREV", "AUTOINC") | ||
| 700 | url = "git://" + src_dir + ";protocol=file;usehead=1;name=newName" | ||
| 701 | try: | ||
| 702 | fetcher = bb.fetch.Fetch([url], self.d) | ||
| 703 | except Exception: | ||
| 704 | # TODO: We currently expect this test to fail. Drop the try and | ||
| 705 | # assert when usehead has been fixed. | ||
| 706 | return | ||
| 707 | self.assertEqual(1, 0) | ||
| 708 | fetcher.download() | ||
| 709 | fetcher.unpack(self.unpackdir) | ||
| 710 | stdout = bb.process.run("git rev-parse HEAD", | ||
| 711 | cwd=os.path.join(self.unpackdir, 'git')) | ||
| 712 | unpack_rev = stdout[0].strip() | ||
| 713 | self.assertEqual(orig_rev, unpack_rev) | ||
| 714 | |||
| 683 | class FetcherNoNetworkTest(FetcherTest): | 715 | class FetcherNoNetworkTest(FetcherTest): |
| 684 | def setUp(self): | 716 | def setUp(self): |
| 685 | super().setUp() | 717 | super().setUp() |
| @@ -879,6 +911,15 @@ class FetcherNetworkTest(FetcherTest): | |||
| 879 | self.assertRaises(bb.fetch.ParameterError, self.gitfetcher, url, url) | 911 | self.assertRaises(bb.fetch.ParameterError, self.gitfetcher, url, url) |
| 880 | 912 | ||
| 881 | @skipIfNoNetwork() | 913 | @skipIfNoNetwork() |
| 914 | def test_gitfetch_usehead_withname(self): | ||
| 915 | # Since self.gitfetcher() sets SRCREV we expect this to override | ||
| 916 | # `usehead=1' and instead fetch the specified SRCREV. See | ||
| 917 | # test_local_gitfetch_usehead() for a positive use of the usehead | ||
| 918 | # feature. | ||
| 919 | url = "git://git.openembedded.org/bitbake;usehead=1;name=newName" | ||
| 920 | self.assertRaises(bb.fetch.ParameterError, self.gitfetcher, url, url) | ||
| 921 | |||
| 922 | @skipIfNoNetwork() | ||
| 882 | def test_gitfetch_finds_local_tarball_for_mirrored_url_when_previous_downloaded_by_the_recipe_url(self): | 923 | def test_gitfetch_finds_local_tarball_for_mirrored_url_when_previous_downloaded_by_the_recipe_url(self): |
| 883 | recipeurl = "git://git.openembedded.org/bitbake" | 924 | recipeurl = "git://git.openembedded.org/bitbake" |
| 884 | mirrorurl = "git://someserver.org/bitbake" | 925 | mirrorurl = "git://someserver.org/bitbake" |
