BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Ihor Solodrai <ihor.solodrai@pm.me>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"ast@kernel.org" <ast@kernel.org>,
	"andrii@kernel.org" <andrii@kernel.org>,
	"mykolal@fb.com" <mykolal@fb.com>
Subject: Re: [PATCH bpf-next v2] selftests/bpf: use auto-dependencies for test objects
Date: Fri, 12 Jul 2024 12:06:18 -0700	[thread overview]
Message-ID: <4d757f19ac6f7e17da2e87f482f129e75c6decf8.camel@gmail.com> (raw)
In-Reply-To: <R36QrBuK6nQziAeE9Xb-8295ISr8B1ofPVAdWaR3rygfaDiHUl2I5EmG2xoCrEskurmOmclGak3JXWwxso43KR9M1LHsdOIt48XS6xe3PVI=@pm.me>

On Fri, 2024-07-12 at 17:48 +0000, Ihor Solodrai wrote:

[...]

> I've made a mistake when I removed $(TRUNNER_BPF_OBJS) as a
> prerequisite for $(TRUNNER_TEST_OBJS:.o=.d)
> 
> I assumed it is covered by:
> 
>   $(TRUNNER_BPF_SKELS): %.skel.h: %.bpf.o $(BPFTOOL) | $(TRUNNER_OUTPUT)
> 
> Apparently there are .bpf.o files for which skels are not generated,
> yet they are used in tests.
> 
> Fixed in v3.

So, bear with me for a moment please.
We have 3 test_progs/smth.c files that depend on a few .bpf.o files at runtime,
but do not include skel files for those .bpf.o, namely:
- core_reloc.c
- verifier_bitfield_write.c
- pinning.c

And we fix this by adding a dependency:

    $(TRUNNER_TEST_OBJS:.o=.d): ... $(TRUNNER_BPF_OBJS)

Which makes all *.test.d files depend on .bpf.o files.
Thus, if progs/some.c file is changed and `make test_progs` is requested:
- because *.test.d files are included into current makefile [1],
  make invokes targets for *.test.d files;
- *.test.d targets depend on *.bpf.o, thus some.bpf.o is rebuilt
  (but only some.bpf.o, dependencies for other *.bpf.o are up to date);
- case A, skel for some.c is not included anywhere (CI failure for v2):
  - nothing happens further, as *.test.d files are unchanged *.test.o
    files are not rebuilt and test_progs is up to date
- case B, skel for some.c is included in prog_tests/other.c:
  - existing other.test.d lists some.skel.h as a dependency;
  - this dependency is not up to date, so other.test.o is rebuilt;
  - test_progs is rebuilt.

Do I understand the above correctly?

An alternative fix would be to specify additional dependencies for
core_reloc.test.o (and others) directly, e.g.:

    core_reloc.test.o: test_core_reloc_module.bpf.o ...

(with correct trunner prefix)

What are pros and cons between these two approaches?

[1] https://make.mad-scientist.net/constructed-include-files/

  reply	other threads:[~2024-07-12 19:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12  4:36 [PATCH bpf-next v2] selftests/bpf: use auto-dependencies for test objects Ihor Solodrai
2024-07-12 15:26 ` Daniel Borkmann
2024-07-12 17:48   ` Ihor Solodrai
2024-07-12 19:06     ` Eduard Zingerman [this message]
2024-07-12 19:20       ` Andrii Nakryiko
2024-07-12 19:46         ` Eduard Zingerman
2024-07-12 19:52           ` Andrii Nakryiko
2024-07-15  1:17             ` Ihor Solodrai
2024-07-15 17:44               ` Andrii Nakryiko
2024-07-16 23:21                 ` Eduard Zingerman
2024-07-17  0:36                   ` Ihor Solodrai
2024-07-17  0:57                     ` Eduard Zingerman
2024-07-17  1:49                       ` Ihor Solodrai
2024-07-17 16:41                   ` Andrii Nakryiko
2024-07-17 23:24                     ` Eduard Zingerman
2024-07-18 15:34                       ` Andrii Nakryiko
2024-07-18 22:42                         ` Ihor Solodrai
2024-07-19  5:02                           ` Andrii Nakryiko

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=4d757f19ac6f7e17da2e87f482f129e75c6decf8.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ihor.solodrai@pm.me \
    --cc=mykolal@fb.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