public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Uday Shankar <ushankar@purestorage.com>,
	Yoav Cohen <yoav@nvidia.com>
Subject: Re: [PATCH 3/3] selftests/ublk: fix Makefile to rebuild on header changes
Date: Tue, 23 Dec 2025 10:18:04 +0800	[thread overview]
Message-ID: <aUn73Gb0c8gVjVWV@fedora> (raw)
In-Reply-To: <CADUfDZq8eMgJWbwD9uFomjmv14PtDf8npsk3_uCUY8=OHuh-mQ@mail.gmail.com>

On Mon, Dec 22, 2025 at 11:48:37AM -0500, Caleb Sander Mateos wrote:
> On Sun, Dec 21, 2025 at 11:42 AM Ming Lei <ming.lei@redhat.com> wrote:
> >
> > Add header dependencies to kublk build rule so that changes to
> > kublk.h, ublk_dep.h, or utils.h trigger a rebuild.
> >
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >  tools/testing/selftests/ublk/Makefile | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
> > index eb0e6cfb00ad..fb7b2273e563 100644
> > --- a/tools/testing/selftests/ublk/Makefile
> > +++ b/tools/testing/selftests/ublk/Makefile
> > @@ -53,8 +53,10 @@ TEST_GEN_PROGS_EXTENDED = kublk
> >
> >  include ../lib.mk
> >
> > -$(TEST_GEN_PROGS_EXTENDED): kublk.c null.c file_backed.c common.c stripe.c \
> > -       fault_inject.c
> > +LOCAL_HDRS += kublk.h ublk_dep.h utils.h
> > +
> > +$(TEST_GEN_PROGS_EXTENDED): $(LOCAL_HDRS) \
> > +       kublk.c null.c file_backed.c common.c stripe.c fault_inject.c
> 
> I'm not really familiar with the selftests Makefile magic, but will
> this end up passing the header files as source files to the cc command
> too? That seems a bit wasteful, but probably won't cause any

I won't do this way, just setup build dependency on local header, please
see `$(OUTPUT)/%:%.c $(LOCAL_HDRS)` in `../lib.mk`.

> compilation failures. Maybe it would be better to explicitly list the
> .c files to pass to the cc command, which seems to be what most of the
> other selftests do.

It can be done in the following way:

diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
index eb0e6cfb00ad..06ba6fde098d 100644
--- a/tools/testing/selftests/ublk/Makefile
+++ b/tools/testing/selftests/ublk/Makefile
@@ -51,10 +51,10 @@ TEST_PROGS += test_stress_07.sh

 TEST_GEN_PROGS_EXTENDED = kublk

+LOCAL_HDRS += $(wildcard *.h)
 include ../lib.mk

-$(TEST_GEN_PROGS_EXTENDED): kublk.c null.c file_backed.c common.c stripe.c \
-       fault_inject.c
+$(TEST_GEN_PROGS_EXTENDED): $(wildcard *.c)

 check:
        shellcheck -x -f gcc *.sh


Thanks,
Ming


      reply	other threads:[~2025-12-23  2:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-21 16:41 [PATCH 0/3] ublk: scan partition in async way Ming Lei
2025-12-21 16:41 ` [PATCH 1/3] " Ming Lei
2025-12-22 16:43   ` Caleb Sander Mateos
2025-12-21 16:41 ` [PATCH 2/3] selftests/ublk: add test for async partition scan Ming Lei
2025-12-21 16:41 ` [PATCH 3/3] selftests/ublk: fix Makefile to rebuild on header changes Ming Lei
2025-12-22 16:48   ` Caleb Sander Mateos
2025-12-23  2:18     ` Ming Lei [this message]

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=aUn73Gb0c8gVjVWV@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ushankar@purestorage.com \
    --cc=yoav@nvidia.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