selftests/ublk: use the configured kernel UAPI headers
Subsystems (3)
PATCH v2 1/1 selftests/ublk: use the configured kernel UAPI headers
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.
---
Changes since v1:
- Rebased onto v7.4-rc3, where 3197517875fd ("selftests: ublk: fix the build and file offsets on 32-bit") touches the same lines. No other change.
KernelCI's kselftest builds of mainline 9437ee8b6cf6 still fail on kublk, metadata_size and ublk_cancel_ready without this, with gcc and clang on arm64 and x86 and with gcc on arm, on undefined UBLK_F_* flags, struct ublk_param_integrity and FS_IOC_GETLBMD_CAP.
v1: https://lore.kernel.org/r/[email protected]
tools/testing/selftests/ublk/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/ublk/Makefile +2 -1
@@ -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) CFLAGS += -D_FILE_OFFSET_BITS=64 ifneq ($(WERROR),0) CFLAGS += -Werror
@@ -86,6 +86,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
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
Signature · 1 line
2.53.0
Quoted 20 lines · Sasha Levin
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_INCLUDESto 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 <[email protected]>---
Changes since v1:
- Rebased onto v7.4-rc3, where3197517875fd("selftests: ublk: fix the build and file offsets on 32-bit") touches the same lines. No other change.
Quoted 6 lines
KernelCI's kselftest builds of mainline
9437ee8b6cf6still fail on kublk,metadata_sizeandublk_cancel_readywithout this, with gcc and clang on arm64 and x86 and with gcc on arm, on undefined UBLK_F_* flags, structublk_param_integrityandFS_IOC_GETLBMD_CAP.
Thanks,
Ming Lei