diff options
author | Pavel Zhukov <pavel@zhukoff.net> | 2022-06-16 18:15:22 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-21 20:50:57 +0100 |
commit | 62af35ffb4203f5b6ad3a66c8ccf7c51fb89f903 (patch) | |
tree | 387657855e3af8fbe9e4734bf943d5c68618ce76 /bitbake/lib | |
parent | 69ff043e625a3cead8b8d653e08c8084bf6eaebf (diff) | |
download | poky-62af35ffb4203f5b6ad3a66c8ccf7c51fb89f903.tar.gz |
bitbake: tests/fetch: Add test for broken mirror tarball
With PREMIRRORS set and BB_NO_NETWORK = "1" bitbake should not try to
fetch into non-initialized git directory if tarball is broken (or not in
gzip format)
[Yocto 14822]
(Bitbake rev: c9aaca3dd2dfdf4a291d6e1f6263037e0f54b4b6)
Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 622c46a05d..ee41bff43e 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -2895,3 +2895,28 @@ class FetchPremirroronlyNetworkTest(FetcherTest): | |||
2895 | fetcher = bb.fetch.Fetch([self.recipe_url], self.d) | 2895 | fetcher = bb.fetch.Fetch([self.recipe_url], self.d) |
2896 | with self.assertRaises(bb.fetch2.NetworkAccess): | 2896 | with self.assertRaises(bb.fetch2.NetworkAccess): |
2897 | fetcher.download() | 2897 | fetcher.download() |
2898 | |||
2899 | class FetchPremirroronlyBrokenTarball(FetcherTest): | ||
2900 | |||
2901 | def setUp(self): | ||
2902 | super(FetchPremirroronlyBrokenTarball, self).setUp() | ||
2903 | self.mirrordir = os.path.join(self.tempdir, "mirrors") | ||
2904 | os.mkdir(self.mirrordir) | ||
2905 | self.reponame = "bitbake" | ||
2906 | self.gitdir = os.path.join(self.tempdir, "git", self.reponame) | ||
2907 | self.recipe_url = "git://git.fake.repo/bitbake" | ||
2908 | self.d.setVar("BB_FETCH_PREMIRRORONLY", "1") | ||
2909 | self.d.setVar("BB_NO_NETWORK", "1") | ||
2910 | self.d.setVar("PREMIRRORS", self.recipe_url + " " + "file://{}".format(self.mirrordir) + " \n") | ||
2911 | self.mirrorname = "git2_git.fake.repo.bitbake.tar.gz" | ||
2912 | with open(os.path.join(self.mirrordir, self.mirrorname), 'w') as targz: | ||
2913 | targz.write("This is not tar.gz file!") | ||
2914 | |||
2915 | def test_mirror_broken_download(self): | ||
2916 | import sys | ||
2917 | self.d.setVar("SRCREV", "0"*40) | ||
2918 | fetcher = bb.fetch.Fetch([self.recipe_url], self.d) | ||
2919 | with self.assertRaises(bb.fetch2.FetchError): | ||
2920 | fetcher.download() | ||
2921 | stdout = sys.stdout.getvalue() | ||
2922 | self.assertFalse(" not a git repository (or any parent up to mount point /)" in stdout) | ||