From 1a344c32427d57d5b41c5172e9644718f511f860 Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Tue, 2 Nov 2021 17:02:44 +0800 Subject: bitbake: tests/fetch.py: add test case to ensure downloadfilename is used for premirror Add a test case test_fetch_premirror_use_downloadfilename_to_fetch to ensure that 'downloadfilename' is used when fetching from premirror. Although the other two previous test cases, test_fetch_premirror_specify_downloadfilename_regex_uri and test_fetch_premirror_specify_downloadfilename_specific_uri already implicitly contain such verification, we still need to add a very clear case to ensure no regression. (Bitbake rev: 057cbba6b7ade134e4fa3584b9e896be025a6f46) Signed-off-by: Chen Qi Signed-off-by: Richard Purdie (cherry picked from commit 20aabc3d53f69949810ecf02295725db947ffef8) Signed-off-by: Anuj Mittal Signed-off-by: Richard Purdie --- bitbake/lib/bb/tests/fetch.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bitbake') diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index d06580db88..a008e7cc5b 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py @@ -887,6 +887,14 @@ class FetcherNetworkTest(FetcherTest): fetcher.download() self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) + @skipIfNoNetwork() + def test_fetch_premirror_use_downloadfilename_to_fetch(self): + # Ensure downloadfilename is used when fetching from premirror. + self.d.setVar("PREMIRRORS", "http://.*/.* https://downloads.yoctoproject.org/releases/bitbake") + fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d) + fetcher.download() + self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) + @skipIfNoNetwork() def gitfetcher(self, url1, url2): def checkrevision(self, fetcher): -- cgit v1.2.3-54-g00ecf