Re: [PATCH 4/4] selftests/mm: fix cow/gup_longterm link failures when liburing flags are missing

From: Li Wang

Date: Tue Mar 31 2026 - 03:14:59 EST


> --- a/tools/testing/selftests/mm/Makefile
> +++ b/tools/testing/selftests/mm/Makefile
> @@ -10,6 +10,11 @@ LOCAL_HDRS += $(selfdir)/mm/mseal_helpers.h
>
> include local_config.mk
>
> +PKG_CONFIG ?= pkg-config
> +ifeq ($(IOURING_EXTRA_LIBS),)
> +IOURING_EXTRA_LIBS := $(shell $(PKG_CONFIG) --libs liburing 2>/dev/null)
> +endif
> +
> ifeq ($(ARCH),)
>
> ifeq ($(CROSS_COMPILE),)
> @@ -55,10 +60,12 @@ else
> PAGE_FRAG_WARNING = "missing Module.symvers, please have the kernel built first"
> endif
>
> -TEST_GEN_FILES = cow
> -TEST_GEN_FILES += compaction_test
> -TEST_GEN_FILES += gup_longterm
> +TEST_GEN_FILES = compaction_test
> TEST_GEN_FILES += gup_test
> +ifneq ($(IOURING_EXTRA_LIBS),)
> +TEST_GEN_FILES += cow
> +TEST_GEN_FILES += gup_longterm
> +endif

Please ignore this one, as Sashiko points:

"The io_uring specific test cases within them are already isolated via
#ifdef LOCAL_CONFIG_HAVE_LIBURING and do not require liburing to compile the
rest of the tests."

I overlooked that two tests can be built without liburing-devel pkg.
Sashiko is correct here, we don't need define IOURING_EXTRA_LIBS.

The compiling error comes from a temp file in check_config.sh, and I
am not sure whether we should hide the error:

/tmp/tmp.kIIOIqwe3n.c:2:10: fatal error: liburing.h: No such file or directory
2 | #include <liburing.h>
| ^~~~~~~~~~~~


--
Regards,
Li Wang