diff options
author | Ross Burton <ross@burtonini.com> | 2021-03-08 18:01:52 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-10 10:30:39 +0000 |
commit | b0df39edd79ec620df6e00fa132fde9558fc95b2 (patch) | |
tree | d1d1d3d79f5b5224fdd68cf314e3a875ff6a35b0 | |
parent | fdb9e868f71318c1247ef4e1b895580e66d9faf5 (diff) | |
download | poky-b0df39edd79ec620df6e00fa132fde9558fc95b2.tar.gz |
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>
-rw-r--r-- | meta-selftest/recipes-test/poison/poison.bb | 16 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/buildoptions.py | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/poison/poison.bb b/meta-selftest/recipes-test/poison/poison.bb new file mode 100644 index 0000000000..7ace901cc3 --- /dev/null +++ b/meta-selftest/recipes-test/poison/poison.bb | |||
@@ -0,0 +1,16 @@ | |||
1 | SUMMARY = "Sysroot poisoning test" | ||
2 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
3 | |||
4 | LICENSE = "MIT" | ||
5 | |||
6 | inherit nopackages | ||
7 | |||
8 | # This test confirms that compiling code that searches /usr/include for headers | ||
9 | # will result in compiler errors. This recipe should will fail to build and | ||
10 | # oe-selftest has a test that verifies that. | ||
11 | do_compile() { | ||
12 | touch empty.c | ||
13 | ${CPP} ${CFLAGS} -I/usr/include empty.c | ||
14 | } | ||
15 | |||
16 | EXCLUDE_FROM_WORLD = "1" | ||
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py index 3495bee986..20fe8ed8f6 100644 --- a/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/meta/lib/oeqa/selftest/cases/buildoptions.py | |||
@@ -197,3 +197,9 @@ PREMIRRORS = "\\ | |||
197 | 197 | ||
198 | bitbake("world --runall fetch") | 198 | bitbake("world --runall fetch") |
199 | 199 | ||
200 | |||
201 | class Poisoning(OESelftestTestCase): | ||
202 | def test_poisoning(self): | ||
203 | res = bitbake("poison", ignore_status=True) | ||
204 | self.assertNotEqual(res.status, 0) | ||
205 | self.assertTrue("is unsafe for cross-compilation" in res.output) | ||