[PATCH v2 13/32] selftests: harness: Guard includes on nolibc

From: Thomas Weißschuh
Date: Mon Apr 07 2025 - 02:56:30 EST


Nolibc doesn't provide all normal header files.

Don't try to include these non-existent header files, as the symbols are
available unconditionally anyways.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
tools/testing/selftests/kselftest_harness.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 1e584f39a42023c400988dea96f0274d4dc3645b..4247c67b3060fbe9d224c1171f3ec998ae6b1080 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -57,16 +57,19 @@
#include <ctype.h>
#include <errno.h>
#include <linux/unistd.h>
-#include <poll.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
+#ifndef NOLIBC
+#include <poll.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <unistd.h>
+#endif

#include "kselftest.h"


--
2.49.0