public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/futex: skip futex_numa_mpol without libnuma
@ 2026-01-29  6:32 Nylon Chen
  2026-02-03 21:35 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Nylon Chen @ 2026-01-29  6:32 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Darren Hart,
	Davidlohr Bueso, André Almeida, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Zong Li, Nylon Chen

Use pkg-config --exists numa to derive HAVE_LIBNUMA.
Only keep futex_numa_mpol in TEST_GEN_PROGS when libnuma is present.

Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
---
 tools/testing/selftests/futex/functional/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
index af7ec309ea78..ec3c39a51182 100644
--- a/tools/testing/selftests/futex/functional/Makefile
+++ b/tools/testing/selftests/futex/functional/Makefile
@@ -1,10 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 PKG_CONFIG ?= pkg-config
+HAVE_LIBNUMA := $(shell sh -c "$(PKG_CONFIG) --exists numa > /dev/null 2>&1 && echo y")
 LIBNUMA_TEST = $(shell sh -c "$(PKG_CONFIG) numa --atleast-version 2.0.16 > /dev/null 2>&1 && echo SUFFICIENT || echo NO")
 
 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
 
 LOCAL_HDRS := \
 	../include/futextest.h \
@@ -27,6 +27,13 @@ TEST_GEN_PROGS := \
 
 TEST_PROGS := run.sh
 
+ifeq ($(HAVE_LIBNUMA),y)
+LDLIBS := -lpthread -lrt -lnuma
+else
+LDLIBS := -lpthread -lrt
+TEST_GEN_PROGS := $(filter-out futex_numa_mpol,$(TEST_GEN_PROGS))
+endif
+
 top_srcdir = ../../../../..
 DEFAULT_INSTALL_HDR_PATH := 1
 include ../../lib.mk

---
base-commit: 8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
change-id: 20260128-b4-futex-test-6de3aca9a3f6

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


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

* Re: [PATCH] selftests/futex: skip futex_numa_mpol without libnuma
  2026-01-29  6:32 [PATCH] selftests/futex: skip futex_numa_mpol without libnuma Nylon Chen
@ 2026-02-03 21:35 ` Thomas Gleixner
  2026-02-09  2:33   ` Nylon Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2026-02-03 21:35 UTC (permalink / raw)
  To: Nylon Chen, Ingo Molnar, Peter Zijlstra, Darren Hart,
	Davidlohr Bueso, André Almeida, Shuah Khan
  Cc: linux-kernel, linux-kselftest, Zong Li, Nylon Chen

On Wed, Jan 28 2026 at 22:32, Nylon Chen wrote:

> Use pkg-config --exists numa to derive HAVE_LIBNUMA.
> Only keep futex_numa_mpol in TEST_GEN_PROGS when libnuma is present.
>
> Signed-off-by: Zong Li <zong.li@sifive.com>
> Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
> ---
>  tools/testing/selftests/futex/functional/Makefile | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
> index af7ec309ea78..ec3c39a51182 100644
> --- a/tools/testing/selftests/futex/functional/Makefile
> +++ b/tools/testing/selftests/futex/functional/Makefile
> @@ -1,10 +1,10 @@
>  # SPDX-License-Identifier: GPL-2.0
>  PKG_CONFIG ?= pkg-config
> +HAVE_LIBNUMA := $(shell sh -c "$(PKG_CONFIG) --exists numa > /dev/null 2>&1 && echo y")
>  LIBNUMA_TEST = $(shell sh -c "$(PKG_CONFIG) numa --atleast-version 2.0.16 > /dev/null 2>&1 && echo SUFFICIENT || echo NO")

Why another test? LIBNUMA_TEST fails when it does not exist or when the
version number is not enough. 

>  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
>  
>  LOCAL_HDRS := \
>  	../include/futextest.h \
> @@ -27,6 +27,13 @@ TEST_GEN_PROGS := \
>  
>  TEST_PROGS := run.sh
>  
> +ifeq ($(HAVE_LIBNUMA),y)
> +LDLIBS := -lpthread -lrt -lnuma
> +else
> +LDLIBS := -lpthread -lrt
> +TEST_GEN_PROGS := $(filter-out futex_numa_mpol,$(TEST_GEN_PROGS))

Why? The test contains more than just the libnuma dependend stuff. There
are two issues here:

One is -lnuma, which is trivial to solve:

LDLIBS := -lpthread -lrt
ifeq ($(LIBNUMA_TEST),SUFFICIENT)
LDLIBS += -lnuma
endif

The other is the include <numa*.h> in the source. I assume you can
figure out how to prevent those headers from being included, right?

Thanks,

        tglx

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

* Re: [PATCH] selftests/futex: skip futex_numa_mpol without libnuma
  2026-02-03 21:35 ` Thomas Gleixner
@ 2026-02-09  2:33   ` Nylon Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Nylon Chen @ 2026-02-09  2:33 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Ingo Molnar, Peter Zijlstra, Darren Hart, Davidlohr Bueso,
	André Almeida, Shuah Khan, linux-kernel, linux-kselftest,
	Zong Li

Hi Thomas,

Thomas Gleixner <tglx@kernel.org> 於 2026年2月4日週三 上午5:35寫道:
>
> On Wed, Jan 28 2026 at 22:32, Nylon Chen wrote:
>
> > Use pkg-config --exists numa to derive HAVE_LIBNUMA.
> > Only keep futex_numa_mpol in TEST_GEN_PROGS when libnuma is present.
> >
> > Signed-off-by: Zong Li <zong.li@sifive.com>
> > Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
> > ---
> >  tools/testing/selftests/futex/functional/Makefile | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
> > index af7ec309ea78..ec3c39a51182 100644
> > --- a/tools/testing/selftests/futex/functional/Makefile
> > +++ b/tools/testing/selftests/futex/functional/Makefile
> > @@ -1,10 +1,10 @@
> >  # SPDX-License-Identifier: GPL-2.0
> >  PKG_CONFIG ?= pkg-config
> > +HAVE_LIBNUMA := $(shell sh -c "$(PKG_CONFIG) --exists numa > /dev/null 2>&1 && echo y")
> >  LIBNUMA_TEST = $(shell sh -c "$(PKG_CONFIG) numa --atleast-version 2.0.16 > /dev/null 2>&1 && echo SUFFICIENT || echo NO")
>
> Why another test? LIBNUMA_TEST fails when it does not exist or when the
> version number is not enough.
You're right, LIBNUMA_TEST already covers the existence check. I'll
remove the redundant HAVE_LIBNUMA variable.
>
> >  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
> >
> >  LOCAL_HDRS := \
> >       ../include/futextest.h \
> > @@ -27,6 +27,13 @@ TEST_GEN_PROGS := \
> >
> >  TEST_PROGS := run.sh
> >
> > +ifeq ($(HAVE_LIBNUMA),y)
> > +LDLIBS := -lpthread -lrt -lnuma
> > +else
> > +LDLIBS := -lpthread -lrt
> > +TEST_GEN_PROGS := $(filter-out futex_numa_mpol,$(TEST_GEN_PROGS))
>
> Why? The test contains more than just the libnuma dependend stuff. There
> are two issues here:
>
> One is -lnuma, which is trivial to solve:
>
> LDLIBS := -lpthread -lrt
> ifeq ($(LIBNUMA_TEST),SUFFICIENT)
> LDLIBS += -lnuma
> endif
>
> The other is the include <numa*.h> in the source. I assume you can
> figure out how to prevent those headers from being included, right?
>
Thank you for the feedback. I'll update the patch to:
1. Use LIBNUMA_TEST instead of adding a new HAVE_LIBNUMA variable
2. Keep futex_numa_mpol in TEST_GEN_PROGS
3. Conditionally add -lnuma based on LIBNUMA_TEST
4. Use #ifdef LIBNUMA_VER_SUFFICIENT to guard the numa header includes
and related code in the source file

I'll send a v2 shortly.
Thanks,
Nylon
> Thanks,
>
>         tglx

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

end of thread, other threads:[~2026-02-09  2:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29  6:32 [PATCH] selftests/futex: skip futex_numa_mpol without libnuma Nylon Chen
2026-02-03 21:35 ` Thomas Gleixner
2026-02-09  2:33   ` Nylon Chen

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