Linux block layer
 help / color / mirror / Atom feed
* [PATCH v2] selftests/ublk: use the configured kernel UAPI headers
@ 2026-11-03 13:01 Sasha Levin
  2026-11-03 14:06 ` Ming Lei
  0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-11-03 13:01 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe
  Cc: Sasha Levin, Uday Shankar, Shuah Khan, linux-block,
	linux-kselftest, linux-kernel

With generated headers in an output directory, the hardcoded source-tree
include path falls through to distribution headers. New ublk flags and
structure members, including UBLK_F_IO_DESC_SIZE, are then missing.

Use KHDR_INCLUDES to consume the headers from the kernel under test, and
add the headers target as an order-only prerequisite of the ublk
programs, as nolibc-test does, so that a standalone build installs them
first. Baseline builds fail on the missing definitions; GCC 14 and Clang
21 builds succeed with the output-directory headers and target liburing
development files available.

Fixes: e371b9d3368c ("selftests: ublk: kublk: fix include path")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Changes since v1:
- Rebased on v7.4-rc1. ublk_cancel_ready got its own rule next to
  kublk in the meantime, no other changes.

v1: https://lore.kernel.org/all/20261014200144.1364828-1-sashal@kernel.org/

 tools/testing/selftests/ublk/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
index fc64b8f028332..b8142bad63a1b 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
@@ -85,6 +85,7 @@ include ../lib.mk
 
 $(OUTPUT)/kublk: $(filter-out $(STANDALONE_UTILS),$(wildcard *.c))
 $(OUTPUT)/ublk_cancel_ready: ublk_cancel_ready.c ctrl.c
+$(TEST_GEN_PROGS_EXTENDED): | headers
 
 check:
 	shellcheck -x -f gcc *.sh
-- 
2.53.0


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

* Re: [PATCH v2] selftests/ublk: use the configured kernel UAPI headers
  2026-11-03 13:01 [PATCH v2] selftests/ublk: use the configured kernel UAPI headers Sasha Levin
@ 2026-11-03 14:06 ` Ming Lei
  0 siblings, 0 replies; 2+ messages in thread
From: Ming Lei @ 2026-11-03 14:06 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Jens Axboe, Uday Shankar, Shuah Khan, linux-block,
	linux-kselftest, linux-kernel

On Tue, Nov 3, 2026 at 7:01 AM Sasha Levin <sashal@kernel.org> wrote:
>
> With generated headers in an output directory, the hardcoded source-tree
> include path falls through to distribution headers. New ublk flags and
> structure members, including UBLK_F_IO_DESC_SIZE, are then missing.
>
> Use KHDR_INCLUDES to consume the headers from the kernel under test, and
> add the headers target as an order-only prerequisite of the ublk
> programs, as nolibc-test does, so that a standalone build installs them
> first. Baseline builds fail on the missing definitions; GCC 14 and Clang
> 21 builds succeed with the output-directory headers and target liburing
> development files available.
>
> Fixes: e371b9d3368c ("selftests: ublk: kublk: fix include path")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> Changes since v1:
> - Rebased on v7.4-rc1. ublk_cancel_ready got its own rule next to
>   kublk in the meantime, no other changes.

Reviewed-by: Ming Lei <tom.leiming@gmail.com>

Thanks,

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

end of thread, other threads:[~2026-11-03 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 13:01 [PATCH v2] selftests/ublk: use the configured kernel UAPI headers Sasha Levin
2026-11-03 14:06 ` Ming Lei

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