Re: [PATCH] selftests/bpf: Copy runqslower to OUTPUT directory

Andrii Nakryiko
2020-04-27T20:18:50Z

On Mon, Apr 27, 2020 at 7:03 AM Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
>
> On Mon, 27 Apr 2020 15:29:40 +0200
> Veronika Kabatova <vkabatov@redhat.com> wrote:
>
> > $(OUTPUT)/runqslower makefile target doesn't actually create runqslower
> > binary in the $(OUTPUT) directory. As lib.mk expects all
> > TEST_GEN_PROGS_EXTENDED (which runqslower is a part of) to be present in
> > the OUTPUT directory, this results in an error when running e.g. `make
> > install`:
> >
> > rsync: link_stat "tools/testing/selftests/bpf/runqslower" failed: No
> > such file or directory (2)
> >
> > Copy the binary into the OUTPUT directory after building it to fix the
> > error.
> >
> > Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
> > ---
>

Did I miss original patch somewhere on bpf@vger mailing list?..

> Looks good to me
>
> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
>
> > tools/testing/selftests/bpf/Makefile | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 7729892e0b04..cb8e7e5b2307 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -142,6 +142,7 @@ $(OUTPUT)/runqslower: $(BPFOBJ)
> > $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \
> > OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF) \
> > BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR)
> > + @cp $(SCRATCH_DIR)/runqslower $(OUTPUT)/runqslower

This should be AND'ed (&&) with $(MAKE) to not attempt copy on failed
make run. Also in general @cp should be $(Q)cp, but if you use $$ you
shouldn't need $(Q).

Also, just use $@ instead of $(OUTPUT)/runqslower:

cp $(SCRATCH_DIR)/runqslower $@

> >
> > $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
>
> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> LinkedIn: http://www.linkedin.com/in/brouer
>