mirror of
git://git.yoctoproject.org/poky
synced 2026-04-02 02:49:11 +00:00
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>
This commit is contained in:
parent
e2527cf58f
commit
7bc521ed34
@ -2034,9 +2034,9 @@ class GitShallowTest(FetcherTest):
|
||||
self.add_empty_file('b')
|
||||
self.git('checkout -b a_branch', cwd=self.srcdir)
|
||||
self.add_empty_file('c')
|
||||
self.git('tag v0.0 HEAD', cwd=self.srcdir)
|
||||
self.add_empty_file('d')
|
||||
self.git('checkout master', cwd=self.srcdir)
|
||||
self.git('tag v0.0 a_branch', cwd=self.srcdir)
|
||||
self.add_empty_file('e')
|
||||
self.git('merge --no-ff --no-edit a_branch', cwd=self.srcdir)
|
||||
self.add_empty_file('f')
|
||||
@ -2052,7 +2052,7 @@ class GitShallowTest(FetcherTest):
|
||||
|
||||
self.fetch_shallow(uri)
|
||||
|
||||
self.assertRevCount(5)
|
||||
self.assertRevCount(4)
|
||||
self.assertRefs(['master', 'origin/master', 'origin/a_branch'])
|
||||
|
||||
def test_shallow_multi_one_uri_depths(self):
|
||||
@ -2199,7 +2199,7 @@ class GitShallowTest(FetcherTest):
|
||||
|
||||
self.fetch_shallow()
|
||||
|
||||
self.assertRevCount(5)
|
||||
self.assertRevCount(2)
|
||||
|
||||
def test_shallow_invalid_revs(self):
|
||||
self.add_empty_file('a')
|
||||
@ -2218,7 +2218,10 @@ class GitShallowTest(FetcherTest):
|
||||
self.git('tag v0.0 master', cwd=self.srcdir)
|
||||
self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0')
|
||||
self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0')
|
||||
self.fetch_shallow()
|
||||
|
||||
with self.assertRaises(bb.fetch2.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm:
|
||||
self.fetch_shallow()
|
||||
self.assertIn("fatal: no commits selected for shallow requests", cm.output[0])
|
||||
|
||||
def test_shallow_fetch_missing_revs_fails(self):
|
||||
self.add_empty_file('a')
|
||||
@ -2249,7 +2252,7 @@ class GitShallowTest(FetcherTest):
|
||||
revs = len(self.git('rev-list master').splitlines())
|
||||
self.assertNotEqual(orig_revs, revs)
|
||||
self.assertRefs(['master', 'origin/master'])
|
||||
self.assertRevCount(orig_revs - 1758)
|
||||
self.assertRevCount(orig_revs - 1760)
|
||||
|
||||
def test_that_unpack_throws_an_error_when_the_git_clone_nor_shallow_tarball_exist(self):
|
||||
self.add_empty_file('a')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user