diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 0b0116b455..3e2ce53056 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1293,6 +1293,48 @@ class GitShallowTest(FetcherTest): | |||
1293 | with self.assertRaises(bb.fetch2.FetchError): | 1293 | with self.assertRaises(bb.fetch2.FetchError): |
1294 | self.fetch() | 1294 | self.fetch() |
1295 | 1295 | ||
1296 | def test_shallow_extra_refs(self): | ||
1297 | self.add_empty_file('a') | ||
1298 | self.add_empty_file('b') | ||
1299 | self.git('branch a_branch', cwd=self.srcdir) | ||
1300 | self.assertRefs(['master', 'a_branch'], cwd=self.srcdir) | ||
1301 | self.assertRevCount(2, cwd=self.srcdir) | ||
1302 | |||
1303 | self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/heads/a_branch') | ||
1304 | self.fetch_shallow() | ||
1305 | |||
1306 | self.assertRefs(['master', 'origin/master', 'origin/a_branch']) | ||
1307 | self.assertRevCount(1) | ||
1308 | |||
1309 | def test_shallow_extra_refs_wildcard(self): | ||
1310 | self.add_empty_file('a') | ||
1311 | self.add_empty_file('b') | ||
1312 | self.git('branch a_branch', cwd=self.srcdir) | ||
1313 | self.git('tag v1.0', cwd=self.srcdir) | ||
1314 | self.assertRefs(['master', 'a_branch', 'v1.0'], cwd=self.srcdir) | ||
1315 | self.assertRevCount(2, cwd=self.srcdir) | ||
1316 | |||
1317 | self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/tags/*') | ||
1318 | self.fetch_shallow() | ||
1319 | |||
1320 | self.assertRefs(['master', 'origin/master', 'v1.0']) | ||
1321 | self.assertRevCount(1) | ||
1322 | |||
1323 | def test_shallow_missing_extra_refs(self): | ||
1324 | self.add_empty_file('a') | ||
1325 | self.add_empty_file('b') | ||
1326 | |||
1327 | self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/heads/foo') | ||
1328 | with self.assertRaises(bb.fetch2.FetchError): | ||
1329 | self.fetch() | ||
1330 | |||
1331 | def test_shallow_missing_extra_refs_wildcard(self): | ||
1332 | self.add_empty_file('a') | ||
1333 | self.add_empty_file('b') | ||
1334 | |||
1335 | self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/tags/*') | ||
1336 | self.fetch() | ||
1337 | |||
1296 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": | 1338 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": |
1297 | print("Unset BB_SKIP_NETTESTS to run network tests") | 1339 | print("Unset BB_SKIP_NETTESTS to run network tests") |
1298 | else: | 1340 | else: |