summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorNylon Chen <nylon.chen@sifive.com>2026-03-02 06:04:34 +0300
committerThomas Gleixner <tglx@kernel.org>2026-03-25 00:59:59 +0300
commit3814c4e145b7a315abd83c85caf97585c63035a4 (patch)
treef2380e599c5a7d84d6d2281cf81aef59a29ff999 /tools/testing
parentd317e2ef9dcf673c9f37cda784284af7c6812757 (diff)
downloadlinux-3814c4e145b7a315abd83c85caf97585c63035a4.tar.xz
selftests/futex: Conditionally include libnuma support
Use LIBNUMA_TEST to conditionally add -lnuma to LDLIBS. Guard numa header includes with #ifdef LIBNUMA_VER_SUFFICIENT to allow compilation without libnuma installed. Co-developed-by: Zong Li <zong.li@sifive.com> Signed-off-by: Zong Li <zong.li@sifive.com> Signed-off-by: Nylon Chen <nylon.chen@sifive.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260301-20260128_nylon_chen_sifive_com-v3-1-995ab4cc71aa@sifive.com
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/futex/functional/Makefile5
-rw-r--r--tools/testing/selftests/futex/functional/futex_numa_mpol.c2
2 files changed, 6 insertions, 1 deletions
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>