summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2024-07-07 00:20:38 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-13 23:30:07 +0100
commit7bc521ed34656165fedaef1dd98cee865092291d (patch)
treedcaaa40437311debf7e4e28d1f4dc875227657ba /bitbake
parente2527cf58f4f390712641a99b276b9e0aeae01c6 (diff)
downloadpoky-7bc521ed34656165fedaef1dd98cee865092291d.tar.gz
bitbake: bitbake: tests/fetch: Update GitShallowTest for clone_shallow_local()
Update the test cases since the implementation is changed: * test_shallow_multi_one_uri() The a_branch and v0.0 had the same revision, and it required fetch a_branch and remove histories of v0.0 which were conflicted, and bitbake reported: fatal: no commits selected for shallow requests Make a_branch and v0.0 have different revs to fix the problem. And now the 'rev^' is not needed, so update self.assertRevCount() as well. * test_shallow_multi_one_uri_depths() Update self.assertRevCount(), now git only fetches the required revs. * test_shallow_fetch_missing_revs() The command is: $ git fetch --shallow-exclude=v0.0 master But master and v0.0 uses the same revision, so there is no commit to fetch. * test_shallow_fetch_missing_revs_fails() Two unneeded committs are not fetched now: - rev^ - One not specified or required tag. So update self.assertRevCount() (Bitbake rev: 48eff9d9a660ad6b9bd8b53a7dcec600ef42b1d1) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/fetch.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 701129d138..2ef2063436 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -2034,9 +2034,9 @@ class GitShallowTest(FetcherTest):
2034 self.add_empty_file('b') 2034 self.add_empty_file('b')
2035 self.git('checkout -b a_branch', cwd=self.srcdir) 2035 self.git('checkout -b a_branch', cwd=self.srcdir)
2036 self.add_empty_file('c') 2036 self.add_empty_file('c')
2037 self.git('tag v0.0 HEAD', cwd=self.srcdir)
2037 self.add_empty_file('d') 2038 self.add_empty_file('d')
2038 self.git('checkout master', cwd=self.srcdir) 2039 self.git('checkout master', cwd=self.srcdir)
2039 self.git('tag v0.0 a_branch', cwd=self.srcdir)
2040 self.add_empty_file('e') 2040 self.add_empty_file('e')
2041 self.git('merge --no-ff --no-edit a_branch', cwd=self.srcdir) 2041 self.git('merge --no-ff --no-edit a_branch', cwd=self.srcdir)
2042 self.add_empty_file('f') 2042 self.add_empty_file('f')
@@ -2052,7 +2052,7 @@ class GitShallowTest(FetcherTest):
2052 2052
2053 self.fetch_shallow(uri) 2053 self.fetch_shallow(uri)
2054 2054
2055 self.assertRevCount(5) 2055 self.assertRevCount(4)
2056 self.assertRefs(['master', 'origin/master', 'origin/a_branch']) 2056 self.assertRefs(['master', 'origin/master', 'origin/a_branch'])
2057 2057
2058 def test_shallow_multi_one_uri_depths(self): 2058 def test_shallow_multi_one_uri_depths(self):
@@ -2199,7 +2199,7 @@ class GitShallowTest(FetcherTest):
2199 2199
2200 self.fetch_shallow() 2200 self.fetch_shallow()
2201 2201
2202 self.assertRevCount(5) 2202 self.assertRevCount(2)
2203 2203
2204 def test_shallow_invalid_revs(self): 2204 def test_shallow_invalid_revs(self):
2205 self.add_empty_file('a') 2205 self.add_empty_file('a')
@@ -2218,7 +2218,10 @@ class GitShallowTest(FetcherTest):
2218 self.git('tag v0.0 master', cwd=self.srcdir) 2218 self.git('tag v0.0 master', cwd=self.srcdir)
2219 self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0') 2219 self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0')
2220 self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0') 2220 self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0')
2221 self.fetch_shallow() 2221
2222 with self.assertRaises(bb.fetch2.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm:
2223 self.fetch_shallow()
2224 self.assertIn("fatal: no commits selected for shallow requests", cm.output[0])
2222 2225
2223 def test_shallow_fetch_missing_revs_fails(self): 2226 def test_shallow_fetch_missing_revs_fails(self):
2224 self.add_empty_file('a') 2227 self.add_empty_file('a')
@@ -2249,7 +2252,7 @@ class GitShallowTest(FetcherTest):
2249 revs = len(self.git('rev-list master').splitlines()) 2252 revs = len(self.git('rev-list master').splitlines())
2250 self.assertNotEqual(orig_revs, revs) 2253 self.assertNotEqual(orig_revs, revs)
2251 self.assertRefs(['master', 'origin/master']) 2254 self.assertRefs(['master', 'origin/master'])
2252 self.assertRevCount(orig_revs - 1758) 2255 self.assertRevCount(orig_revs - 1760)
2253 2256
2254 def test_that_unpack_throws_an_error_when_the_git_clone_nor_shallow_tarball_exist(self): 2257 def test_that_unpack_throws_an_error_when_the_git_clone_nor_shallow_tarball_exist(self):
2255 self.add_empty_file('a') 2258 self.add_empty_file('a')