diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-18 13:18:35 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-19 11:46:31 +0000 |
commit | 122de6fd0f5b65689a0099bad6c0d423b8227241 (patch) | |
tree | e4af43e42a4e5f77bd9e21f1e5b338a6e9cb7824 /bitbake/lib | |
parent | b56a3354817b53d0e512166a087ee441a437f216 (diff) | |
download | poky-122de6fd0f5b65689a0099bad6c0d423b8227241.tar.gz |
bitbake: tests/fetch: Add git tag verification tests
Add tests for git tag verification in both standard and shallow clones.
(Bitbake rev: f47127066d67e2ad80974fa1e7c0fcc7409161af)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index b4e9255578..441b3f8236 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -3172,6 +3172,65 @@ class GitSharedTest(FetcherTest): | |||
3172 | alt = os.path.join(self.unpackdir, 'git/.git/objects/info/alternates') | 3172 | alt = os.path.join(self.unpackdir, 'git/.git/objects/info/alternates') |
3173 | self.assertFalse(os.path.exists(alt)) | 3173 | self.assertFalse(os.path.exists(alt)) |
3174 | 3174 | ||
3175 | class GitTagVerificationTests(FetcherTest): | ||
3176 | |||
3177 | @skipIfNoNetwork() | ||
3178 | def test_tag_rev_match(self): | ||
3179 | # Test a url with rev= and tag= set works | ||
3180 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=aa0e540fc31a1c26839efd2c7785a751ce24ebfb;tag=2.8.7"], self.d) | ||
3181 | fetcher.download() | ||
3182 | fetcher.unpack(self.unpackdir) | ||
3183 | |||
3184 | @skipIfNoNetwork() | ||
3185 | def test_tag_rev_match2(self): | ||
3186 | # Test a url with SRCREV and tag= set works | ||
3187 | self.d.setVar('SRCREV', 'aa0e540fc31a1c26839efd2c7785a751ce24ebfb') | ||
3188 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;tag=2.8.7"], self.d) | ||
3189 | fetcher.download() | ||
3190 | fetcher.unpack(self.unpackdir) | ||
3191 | |||
3192 | @skipIfNoNetwork() | ||
3193 | def test_tag_rev_match3(self): | ||
3194 | # Test a url with SRCREV, rev= and tag= set works | ||
3195 | self.d.setVar('SRCREV', 'aa0e540fc31a1c26839efd2c7785a751ce24ebfb') | ||
3196 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=aa0e540fc31a1c26839efd2c7785a751ce24ebfb;tag=2.8.7"], self.d) | ||
3197 | fetcher.download() | ||
3198 | fetcher.unpack(self.unpackdir) | ||
3199 | |||
3200 | @skipIfNoNetwork() | ||
3201 | def test_tag_rev_match4(self): | ||
3202 | # Test a url with SRCREV and rev= mismatching errors | ||
3203 | self.d.setVar('SRCREV', 'bade540fc31a1c26839efd2c7785a751ce24ebfb') | ||
3204 | with self.assertRaises(bb.fetch2.FetchError): | ||
3205 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=aa0e540fc31a1c26839efd2c7785a751ce24ebfb;tag=2.8.7"], self.d) | ||
3206 | |||
3207 | @skipIfNoNetwork() | ||
3208 | def test_tag_rev_match5(self): | ||
3209 | # Test a url with SRCREV, rev= and tag= set works when using shallow clones | ||
3210 | self.d.setVar('BB_GIT_SHALLOW', '1') | ||
3211 | self.d.setVar('SRCREV', 'aa0e540fc31a1c26839efd2c7785a751ce24ebfb') | ||
3212 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=aa0e540fc31a1c26839efd2c7785a751ce24ebfb;tag=2.8.7"], self.d) | ||
3213 | fetcher.download() | ||
3214 | fetcher.unpack(self.unpackdir) | ||
3215 | |||
3216 | @skipIfNoNetwork() | ||
3217 | def test_tag_rev_match6(self): | ||
3218 | # Test a url with SRCREV, rev= and a mismatched tag= when using shallow clones | ||
3219 | self.d.setVar('BB_GIT_SHALLOW', '1') | ||
3220 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=aa0e540fc31a1c26839efd2c7785a751ce24ebfb;tag=2.8.6"], self.d) | ||
3221 | fetcher.download() | ||
3222 | with self.assertRaises(bb.fetch2.FetchError): | ||
3223 | fetcher.unpack(self.unpackdir) | ||
3224 | |||
3225 | @skipIfNoNetwork() | ||
3226 | def test_tag_rev_match7(self): | ||
3227 | # Test a url with SRCREV, rev= and a mismatched tag= | ||
3228 | self.d.setVar('SRCREV', 'aa0e540fc31a1c26839efd2c7785a751ce24ebfb') | ||
3229 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=aa0e540fc31a1c26839efd2c7785a751ce24ebfb;tag=2.8.6"], self.d) | ||
3230 | fetcher.download() | ||
3231 | with self.assertRaises(bb.fetch2.FetchError): | ||
3232 | fetcher.unpack(self.unpackdir) | ||
3233 | |||
3175 | 3234 | ||
3176 | class FetchPremirroronlyLocalTest(FetcherTest): | 3235 | class FetchPremirroronlyLocalTest(FetcherTest): |
3177 | 3236 | ||