aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2019-10-21 22:09:54 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-23 22:58:23 +0100
commitf7a973604fbfd1059875ff1fabb3f885df9c5b95 (patch)
treeea526b6f60c73f3cbb46e7577b59522cca5e9ad9
parent93b65e3c6ca64f644946953980595c44fbbcc748 (diff)
downloadbitbake-f7a973604fbfd1059875ff1fabb3f885df9c5b95.tar.gz
tests/fetch: add test for fetching shallow revs
[YOCTO #13586] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/tests/fetch.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index a0b656b61..83fad3ff0 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -1863,6 +1863,26 @@ class GitShallowTest(FetcherTest):
with self.assertRaises(bb.fetch2.FetchError):
self.fetch()
+ def test_shallow_fetch_missing_revs(self):
+ self.add_empty_file('a')
+ self.add_empty_file('b')
+ fetcher, ud = self.fetch(self.d.getVar('SRC_URI'))
+ 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()
+
+ def test_shallow_fetch_missing_revs_fails(self):
+ self.add_empty_file('a')
+ self.add_empty_file('b')
+ fetcher, ud = self.fetch(self.d.getVar('SRC_URI'))
+ self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0')
+ self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0')
+
+ with self.assertRaises(bb.fetch2.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm:
+ self.fetch_shallow()
+ self.assertIn("Unable to find revision v0.0 even from upstream", cm.output[0])
+
@skipIfNoNetwork()
def test_bitbake(self):
self.git('remote add --mirror=fetch origin git://github.com/openembedded/bitbake', cwd=self.srcdir)