netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>,
	 Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	 netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,  Shuah Khan <shuah@kernel.org>,
	 Willem de Bruijn <willemb@google.com>,
	 Lucas Karpinski <lkarpins@redhat.com>,
	 linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net 1/3] selftests: net: remove dependency on ebpf tests
Date: Thu, 25 Jan 2024 10:38:19 -0500	[thread overview]
Message-ID: <65b2806b90b29_2bce412943c@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <6cb2ddf941698e2feb780dfae9325e98cd39d7a9.camel@redhat.com>

Paolo Abeni wrote:
> On Thu, 2024-01-25 at 09:27 -0500, Willem de Bruijn wrote:
> > Paolo Abeni wrote:
> > > On Wed, 2024-01-24 at 20:10 -0500, Willem de Bruijn wrote:
> > > > Paolo Abeni wrote:
> > > > > Several net tests requires an XDP program build under the ebpf
> > > > > directory, and error out if such program is not available.
> > > > > 
> > > > > That makes running successful net test hard, let's duplicate into the
> > > > > net dir the [very small] program, re-using the existing rules to build
> > > > > it, and finally dropping the bogus dependency.
> > > > > 
> > > > > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> > > > > ---
> > > > >  tools/testing/selftests/net/Makefile          |  5 +++--
> > > > >  tools/testing/selftests/net/udpgro.sh         |  4 ++--
> > > > >  tools/testing/selftests/net/udpgro_bench.sh   |  4 ++--
> > > > >  tools/testing/selftests/net/udpgro_frglist.sh |  6 +++---
> > > > >  tools/testing/selftests/net/udpgro_fwd.sh     |  2 +-
> > > > >  tools/testing/selftests/net/veth.sh           |  4 ++--
> > > > >  tools/testing/selftests/net/xdp_dummy.c       | 13 +++++++++++++
> > > > >  7 files changed, 26 insertions(+), 12 deletions(-)
> > > > >  create mode 100644 tools/testing/selftests/net/xdp_dummy.c
> > > > > 
> > > > > diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
> > > > > index 50818075e566..304d8b852ef0 100644
> > > > > --- a/tools/testing/selftests/net/Makefile
> > > > > +++ b/tools/testing/selftests/net/Makefile
> > > > > @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh
> > > > >  TEST_GEN_FILES += sctp_hello
> > > > >  TEST_GEN_FILES += csum
> > > > >  TEST_GEN_FILES += nat6to4.o
> > > > > +TEST_GEN_FILES += xdp_dummy.o
> > > > >  TEST_GEN_FILES += ip_local_port_range
> > > > >  TEST_GEN_FILES += bind_wildcard
> > > > >  TEST_PROGS += test_vxlan_mdb.sh
> > > > > @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread
> > > > >  $(OUTPUT)/bind_bhash: LDLIBS += -lpthread
> > > > >  $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/
> > > > >  
> > > > > -# Rules to generate bpf obj nat6to4.o
> > > > > +# Rules to generate bpf objs
> > > > >  CLANG ?= clang
> > > > >  SCRATCH_DIR := $(OUTPUT)/tools
> > > > >  BUILD_DIR := $(SCRATCH_DIR)/build
> > > > > @@ -139,7 +140,7 @@ endif
> > > > >  
> > > > >  CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
> > > > >  
> > > > > -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS)
> > > > > +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS)
> > > > >  	$(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@
> > > > 
> > > > is the "$(OUTPUT)/%.o :" intentional or a leftover from editing?
> > > 
> > > Is intentional and AFAICS required to let this rule being selected when
> > > the output directory is not an empty string (the target and the pre-req
> > > will be in different directories).
> > 
> > Thanks. I don't understand why. Sorry to harp on this small point, but
> > you've verified that the build fails without? Is it perhaps due to that
> > "$(MAKE_DIRS)" order-only-prerequisite? But nat6to4 on its own did not
> > need this.
> 
> I tried quite a bit of permutation (all others failing) before
> selecting this one (shame on me, with a stackoverflow hint [!!!]).
> 
> But I finally found the relevant documentation reference:
> 
> https://www.gnu.org/software/make/manual/make.html#Static-Pattern
> 
> A simpler wildcard rule would not be enough, as the already existing
> wildcard used to build plain c files will take precedence.
> 
> nat6to4 did not need this fancy syntax, as it was a simple, single
> target single pre-req rule - that takes precedence on the mentioned
> wildcard.
> 
> Please let me know if the above clarifies a bit the scenario.

Reviewed-by: Willem de Bruijn <willemb@google.com>

Thanks for looking that up!

So the wildcard is needed for the %.c in the new rule. Makes sense.


  reply	other threads:[~2024-01-25 15:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 21:33 [PATCH net 0/3] selftests: net: a few fixes Paolo Abeni
2024-01-24 21:33 ` [PATCH net 1/3] selftests: net: remove dependency on ebpf tests Paolo Abeni
2024-01-25  1:10   ` Willem de Bruijn
2024-01-25  7:32     ` Paolo Abeni
2024-01-25 14:27       ` Willem de Bruijn
2024-01-25 15:19         ` Paolo Abeni
2024-01-25 15:38           ` Willem de Bruijn [this message]
2024-01-24 21:33 ` [PATCH net 2/3] selftests: net: included needed helper in the install targets Paolo Abeni
2024-01-25  1:14   ` Willem de Bruijn
2024-01-24 21:33 ` [PATCH net 3/3] selftests: net: explicitly wait for listener ready Paolo Abeni
2024-01-25  1:15   ` Willem de Bruijn
2024-01-25  1:45 ` [PATCH net 0/3] selftests: net: a few fixes Jakub Kicinski
2024-01-26  0:10 ` patchwork-bot+netdevbpf

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=65b2806b90b29_2bce412943c@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lkarpins@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=willemb@google.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;
as well as URLs for NNTP newsgroup(s).