]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
meta-selftest/poison: improve sysroot poisoning test case
authorRoss Burton <ross.burton@arm.com>
Wed, 7 Sep 2022 13:02:05 +0000 (14:02 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 7 Sep 2022 20:27:29 +0000 (21:27 +0100)
It was discovered by Martin Jansa that the sysroot poisoning errors are
not functioning as they should. Due to either a bug from day 1 or a
bad rebase, -Werror=poison-system-directories is only passed when GCC
is invoking _just_ the preprocessor, not the compiler.

Demonstrate this by expanding the test case to exercise not just $CPP,
but also $CC for both C and C++ languages. This improved test case now
fails.

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

index 7ace901cc3ac120d5fa9863407bfb5255a054caf..e9eee0cdbabab48ddafe81dac8a682c4b312fc2b 100644 (file)
@@ -9,8 +9,12 @@ inherit nopackages
 # 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
+    bbnote Testing preprocessor
+    echo "int main(int argc, char** argv) {}" | ${CPP} -I/usr/include -
+    bbnote Testing C compiler
+    echo "int main(int argc, char** argv) {}" | ${CC} -x c -I/usr/include -
+    bbnote Testing C++ compiler
+    echo "int main(int argc, char** argv) {}" | ${CC} -x c++ -I/usr/include -
 }
 
 EXCLUDE_FROM_WORLD = "1"