summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline-fail.bb16
-rw-r--r--meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline.bb5
-rw-r--r--meta/lib/oeqa/selftest/cases/bbtests.py24
3 files changed, 45 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline-fail.bb b/meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline-fail.bb
new file mode 100644
index 0000000000..602e895199
--- /dev/null
+++ b/meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline-fail.bb
@@ -0,0 +1,16 @@
1SUMMARY = "Test recipe for fetching git submodules"
2HOMEPAGE = "https://git.yoctoproject.org/git/matchbox-panel-2"
3LICENSE = "GPL-2.0-or-later"
4LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
5
6INHIBIT_DEFAULT_DEPS = "1"
7
8TAGVALUE = "2.10"
9
10# Deliberately have a tag which has to be resolved but ensure do_unpack doesn't access the network again.
11SRC_URI = "git://git.yoctoproject.org/git/matchbox-panel-2;branch=master;protocol=https"
12SRC_URI:append:gitunpack-enable-recipe = ";tag=${TAGVALUE}"
13SRCREV = "f82ca3f42510fb3ef10f598b393eb373a2c34ca7"
14SRCREV:gitunpack-enable-recipe = ""
15
16S = "${WORKDIR}/git"
diff --git a/meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline.bb b/meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline.bb
new file mode 100644
index 0000000000..597c89b199
--- /dev/null
+++ b/meta-selftest/recipes-test/gitunpackoffline/gitunpackoffline.bb
@@ -0,0 +1,5 @@
1require gitunpackoffline-fail.bb
2
3TAGVALUE = "2.11"
4
5PV = "0.0+git${SRCPV}"
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
index 246cb032bf..695cabef8a 100644
--- a/meta/lib/oeqa/selftest/cases/bbtests.py
+++ b/meta/lib/oeqa/selftest/cases/bbtests.py
@@ -312,3 +312,27 @@ INHERIT:remove = \"report-error\"
312 self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") 312 self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"")
313 self.delete_recipeinc(test_recipe) 313 self.delete_recipeinc(test_recipe)
314 bitbake('-cclean man-db') 314 bitbake('-cclean man-db')
315
316 def test_git_unpack_nonetwork(self):
317 """
318 Test that a recipe with a floating tag that needs to be resolved upstream doesn't
319 access the network in a patch task run in a separate builld invocation
320 """
321
322 # Enable the recipe to float using a distro override
323 self.write_config("DISTROOVERRIDES .= \":gitunpack-enable-recipe\"")
324
325 bitbake('gitunpackoffline -c fetch')
326 bitbake('gitunpackoffline -c patch')
327
328 def test_git_unpack_nonetwork_fail(self):
329 """
330 Test that a recipe with a floating tag which doesn't call get_srcrev() in the fetcher
331 raises an error when the fetcher is called.
332 """
333
334 # Enable the recipe to float using a distro override
335 self.write_config("DISTROOVERRIDES .= \":gitunpack-enable-recipe\"")
336
337 result = bitbake('gitunpackoffline-fail -c fetch', ignore_status=True)
338 self.assertTrue("Recipe uses a floating tag/branch without a fixed SRCREV" in result.output, msg = "Recipe without PV set to SRCPV should have failed: %s" % result.output)