浏览代码

oeqa/selftest: add test to verify that poisoned sysroots are detected

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.

(From OE-Core rev: b3e3eba796b843021b264f0e98dc30f983775d58)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Ross Burton 4 年之前
父节点
当前提交
b0df39edd7
共有 2 个文件被更改,包括 22 次插入0 次删除
  1. 16 0
      meta-selftest/recipes-test/poison/poison.bb
  2. 6 0
      meta/lib/oeqa/selftest/cases/buildoptions.py

+ 16 - 0
meta-selftest/recipes-test/poison/poison.bb

@@ -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"

+ 6 - 0
meta/lib/oeqa/selftest/cases/buildoptions.py

@@ -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)