public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests/futex: conditionally include libnuma support
@ 2026-02-10  9:50 Nylon Chen
  2026-02-13  8:05 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Nylon Chen @ 2026-02-10  9:50 UTC (permalink / raw)
  To: tglx, mingo, shuah
  Cc: peterz, dvhart, dave, andrealmeid, linux-kernel, linux-kselftest,
	zong.li, Nylon Chen

Use LIBNUMA_TEST to conditionally add -lnuma to LDLIBS.
Guard numa header includes with #ifdef LIBNUMA_VER_SUFFICIENT
to allow compilation without libnuma installed.

Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
---
Changes in v2:
- Remove redundant HAVE_LIBNUMA variable, use existing LIBNUMA_TEST
- Keep futex_numa_mpol in TEST_GEN_PROGS
- Conditionally add -lnuma based on LIBNUMA_TEST
- Use #ifdef LIBNUMA_VER_SUFFICIENT to guard numa headers in source

selftests/futex: conditionally include libnuma support
---
 tools/testing/selftests/futex/functional/Makefile          | 5 ++++-
 tools/testing/selftests/futex/functional/futex_numa_mpol.c | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
index af7ec309ea78..b65ad750395e 100644
--- a/tools/testing/selftests/futex/functional/Makefile
+++ b/tools/testing/selftests/futex/functional/Makefile
@@ -4,7 +4,10 @@ LIBNUMA_TEST = $(shell sh -c "$(PKG_CONFIG) numa --atleast-version 2.0.16 > /dev
 
 INCLUDES := -I../include -I../../ $(KHDR_INCLUDES)
 CFLAGS := $(CFLAGS) -g -O2 -Wall -pthread -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $(INCLUDES) $(KHDR_INCLUDES) -DLIBNUMA_VER_$(LIBNUMA_TEST)=1
-LDLIBS := -lpthread -lrt -lnuma
+LDLIBS := -lpthread -lrt
+ifeq ($(LIBNUMA_TEST),SUFFICIENT)
+LDLIBS += -lnuma
+endif
 
 LOCAL_HDRS := \
 	../include/futextest.h \
diff --git a/tools/testing/selftests/futex/functional/futex_numa_mpol.c b/tools/testing/selftests/futex/functional/futex_numa_mpol.c
index 220ef219c823..35ad2177f5af 100644
--- a/tools/testing/selftests/futex/functional/futex_numa_mpol.c
+++ b/tools/testing/selftests/futex/functional/futex_numa_mpol.c
@@ -10,8 +10,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#ifdef LIBNUMA_VER_SUFFICIENT
 #include <numa.h>
 #include <numaif.h>
+#endif
 
 #include <linux/futex.h>
 #include <sys/mman.h>

---
base-commit: 8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
change-id: 20260210-20260128_nylon_chen_sifive_com-ae6fda01734a

Best regards,
-- 
Nylon Chen <nylon.chen@sifive.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-13  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10  9:50 [PATCH v2] selftests/futex: conditionally include libnuma support Nylon Chen
2026-02-13  8:05 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox