[PATCH] selftests: ublk: Fix include path for out-of-tree builds
From: Thomas Huth
Date: Wed Nov 04 2026 - 05:49:29 EST
When building the seltests out of tree with "make kselftest-all",
the compilation of the ublk tests can currently fail since they
are using the headers from the distro instead the headers from the
kernel source. For example, I'm getting:
kublk.c: In function ‘ublk_ctrl_dump’:
kublk.c:190:27: error: ‘UBLK_F_IO_DESC_SIZE’ undeclared (first use in
this function); did you mean ‘UBLK_F_UPDATE_SIZE’?
190 | if (info->flags & UBLK_F_IO_DESC_SIZE)
| ^~~~~~~~~~~~~~~~~~~
| UBLK_F_UPDATE_SIZE
kublk.c:190:27: note: each undeclared identifier is reported only once
for each function it appears in
kublk.c:191:53: error: ‘struct ublksrv_ctrl_dev_info’ has no member
named ‘io_desc_size’
191 | ublk_log("\tio_desc_size %u\n", info->io_desc_size);
| ^~
... etc ...
Fix it by using the KHDR_INCLUDES from the main selftest Makefile that
should contain the right include path in either case.
Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
---
tools/testing/selftests/ublk/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
index fc64b8f028332..ba6df7c0b530b 100644
--- a/tools/testing/selftests/ublk/Makefile
+++ b/tools/testing/selftests/ublk/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir)/usr/include
+CFLAGS += -O3 -Wl,-no-as-needed -Wall $(KHDR_INCLUDES)
ifneq ($(WERROR),0)
CFLAGS += -Werror
endif
--
2.56.0