* [PATCH] selftests: ublk: Fix include path for out-of-tree builds
@ 2026-11-04 10:49 Thomas Huth
2026-11-04 15:24 ` Caleb Sander Mateos
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2026-11-04 10:49 UTC (permalink / raw)
To: Ming Lei, Shuah Khan; +Cc: linux-block, linux-kselftest, linux-kernel
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@redhat.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: ublk: Fix include path for out-of-tree builds
2026-11-04 10:49 [PATCH] selftests: ublk: Fix include path for out-of-tree builds Thomas Huth
@ 2026-11-04 15:24 ` Caleb Sander Mateos
0 siblings, 0 replies; 2+ messages in thread
From: Caleb Sander Mateos @ 2026-11-04 15:24 UTC (permalink / raw)
To: Thomas Huth
Cc: Ming Lei, Shuah Khan, linux-block, linux-kselftest, linux-kernel
On Wed, Nov 4, 2026 at 2:49 AM Thomas Huth <thuth@redhat.com> wrote:
>
> 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@redhat.com>
> ---
> 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)
Sasha Levin already sent a patch for this:
https://lore.kernel.org/linux-block/20261103130131.4069212-7-sashal@kernel.org/
Best,
Caleb
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-04 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 10:49 [PATCH] selftests: ublk: Fix include path for out-of-tree builds Thomas Huth
2026-11-04 15:24 ` Caleb Sander Mateos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®