]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/selftest: add test to verify that poisoned sysroots are detected
authorRoss Burton <ross@burtonini.com>
Mon, 8 Mar 2021 18:01:52 +0000 (18:01 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 10 Mar 2021 10:29:44 +0000 (10:29 +0000)
Add a recipe that explicitly searches /usr/include, and use that in
oe-selftest to verify that host include paths are correctly causing
build failures.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta-selftest/recipes-test/poison/poison.bb [new file with mode: 0644]
meta/lib/oeqa/selftest/cases/buildoptions.py

diff --git a/meta-selftest/recipes-test/poison/poison.bb b/meta-selftest/recipes-test/poison/poison.bb
new file mode 100644 (file)
index 0000000..7ace901
--- /dev/null
@@ -0,0 +1,16 @@
+SUMMARY = "Sysroot poisoning test"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+LICENSE = "MIT"
+
+inherit nopackages
+
+# This test confirms that compiling code that searches /usr/include for headers
+# will result in compiler errors.  This recipe should will fail to build and
+# oe-selftest has a test that verifies that.
+do_compile() {
+    touch empty.c
+    ${CPP} ${CFLAGS} -I/usr/include empty.c
+}
+
+EXCLUDE_FROM_WORLD = "1"
index 3495bee986a31098e8cb3d8a9f8d17bf5b20dbed..20fe8ed8f63249986a169fd776a8eb40ab9b175e 100644 (file)
@@ -197,3 +197,9 @@ PREMIRRORS = "\\
 
         bitbake("world --runall fetch")
 
+
+class Poisoning(OESelftestTestCase):
+    def test_poisoning(self):
+        res = bitbake("poison", ignore_status=True)
+        self.assertNotEqual(res.status, 0)
+        self.assertTrue("is unsafe for cross-compilation" in res.output)