Re: [PATCH bpf-next v4] selftests/bpf: use auto-dependencies for test objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, July 22nd, 2024 at 5:57 PM, Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:

> On Mon, 2024-07-22 at 17:39 -0700, Alexei Starovoitov wrote:
> 
> [...]
> 
> > Andrii, Ihor,
> > 
> > not sure what happened, but 'make clean' now takes forever.
> > Pls take a look.
> 
> 
> It happens under certain conditions, here is a scenario that behaves
> badly for me:
> [...]

This is an oversight in the auto-dependency patch...

Make automagically rebuilds dependencies of included makefiles if they have changed.

So, for example, if you do:

    $ make -j
    $ touch progs/verifier_and.c
    $ make clean

You'll get:

  CLNG-BPF [test_maps] verifier_and.bpf.o
  GEN-SKEL [test_progs] verifier_and.skel.h
  CLNG-BPF [test_maps] verifier_and.bpf.o
  GEN-SKEL [test_progs-cpuv4] verifier_and.skel.h
  CLNG-BPF [test_maps] verifier_and.bpf.o
  GEN-SKEL [test_progs-no_alu32] verifier_and.skel.h
  CLEAN    
  CLEAN   /opt/linux/tools/testing/selftests/bpf/bpf_testmod/Module.symvers
  CLEAN   eBPF_helpers-manpage
  CLEAN   eBPF_syscall-manpage

That is, dependencies of verifier_and.test.d are rebuilt, which would
be appropriate for other targets like test_progs.

I found a suggested workaround in makefile docs [1]:

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 05b234248..74f829952 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -608,7 +608,9 @@ $(TRUNNER_TEST_OBJS:.o=.d): $(TRUNNER_OUTPUT)/%.test.d:                     \
                            $(TRUNNER_BPF_SKELS_LINKED)                 \
                            $$(BPFOBJ) | $(TRUNNER_OUTPUT)
 
+ifeq ($(filter clean docs-clean,$(MAKECMDGOALS)),)
 include $(wildcard $(TRUNNER_TEST_OBJS:.o=.d))
+endif
 
 $(TRUNNER_EXTRA_OBJS): $(TRUNNER_OUTPUT)/%.o:                          \
                       %.c                                              \

Basically, we can list the targets for which %.d files should be
ignored.

I suppose "clean" and "docs-clean" are the only relevant clean targets?

[1] https://www.gnu.org/software/make/manual/make.html#Goals







[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux