]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/nolibc: validate NOLIBC_IGNORE_ERRNO compilation
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 11 Mar 2026 22:00:50 +0000 (23:00 +0100)
committerThomas Weißschuh <linux@weissschuh.net>
Fri, 20 Mar 2026 16:58:28 +0000 (17:58 +0100)
When NOLIBC_IGNORE_ERRNO is set, various bits of nolibc are disabled.

Make sure that all the ifdeffery does not result in any compilation
errors by compiling a dummy source file.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260311-nolibc-err-h-v1-2-735a9de7f15d@weissschuh.net
tools/testing/selftests/nolibc/Makefile.include
tools/testing/selftests/nolibc/nolibc-test-ignore-errno.c [new file with mode: 0644]

index 6455373d56be647d6c5b19e9d1cb605f24c95da5..41a0039f774c94f387a802519308ae168a48f032 100644 (file)
@@ -9,4 +9,4 @@ CFLAGS_NOLIBC_TEST  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -
                $(call cc-option,-fno-stack-protector) $(call cc-option,-Wmissing-prototypes) \
                $(_CFLAGS_STACKPROTECTOR) $(_CFLAGS_SANITIZER)
 
-NOLIBC_TEST_SOURCES := nolibc-test.c nolibc-test-linkage.c
+NOLIBC_TEST_SOURCES := nolibc-test.c nolibc-test-linkage.c nolibc-test-ignore-errno.c
diff --git a/tools/testing/selftests/nolibc/nolibc-test-ignore-errno.c b/tools/testing/selftests/nolibc/nolibc-test-ignore-errno.c
new file mode 100644 (file)
index 0000000..aea816d
--- /dev/null
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#define NOLIBC_IGNORE_ERRNO
+
+/* Include all of nolibc and make sure everything compiles */
+#include <stdlib.h>