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/