mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Ming Lei <tom.leiming@gmail.com>, Shuah Khan <shuah@kernel.org>
Cc: linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] selftests: ublk: Fix include path for out-of-tree builds
Date: Wed,  4 Nov 2026 11:49:08 +0100	[thread overview]
Message-ID: <20261104104909.129656-1-thuth@redhat.com> (raw)

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


             reply	other threads:[~2026-11-04 10:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 10:49 Thomas Huth [this message]
2026-11-04 15:24 ` Caleb Sander Mateos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261104104909.129656-1-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tom.leiming@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®