On 7/10/26 3:09 PM, Ricardo B. Marlière wrote:
> prog_tests/resolve_btfids.c looks for "resolve_btfids.test.o.BTF" relative
> to the running test_progs binary. resolve_btfids always writes
> <obj.path>.BTF next to the object it processes, so building
> resolve_btfids.test.o also produces resolve_btfids.test.o.BTF in the build
> output directory as a side effect.
> 
> INSTALL_RULE never carries it over: it is not part of TEST_FILES,
> TEST_GEN_FILES or TRUNNER_EXTRA_FILES, and it is not copied by the *.bpf.o
> rsync used for TEST_INST_SUBDIRS. After "make install", every flavor of
> test_progs, including the default one, fails with "Failed to load BTF from
> resolve_btfids.test.o.BTF", even though the file built fine and BTF ID
> resolution itself works correctly.
> 
> Install it next to the rest of the per-flavor build output, using an
> explicit rsync in INSTALL_RULE like the one already used for bpftool.
> 
> Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary 
> output")
> Signed-off-by: Ricardo B. Marlière <[email protected]>
> ---
>  tools/testing/selftests/bpf/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/Makefile 
> b/tools/testing/selftests/bpf/Makefile
> index 47911c9b4977..7260d672acf7 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -1057,10 +1057,11 @@ override define INSTALL_RULE
>       $(DEFAULT_INSTALL_RULE)
>       @mkdir -p $(INSTALL_PATH)/tools/sbin
>       @rsync -a $(if $(PERMISSIVE),--ignore-missing-args) $(TRUNNER_BPFTOOL) 
> $(INSTALL_PATH)/tools/sbin/
> +     @rsync -a $(if $(PERMISSIVE),--ignore-missing-args) 
> $(OUTPUT)/resolve_btfids.test.o.BTF $(INSTALL_PATH)/

I think you can squash patches #1 and #2 into a single "Fix make
install target" patch.

pw-bot: cr

nit: This hardcodes the filename, and even though we only have one
test that needs .BTF currently, you could add *.BTF to the loop:

        $(OUTPUT)/$$DIR/*.bpf.o $(OUTPUT)/$$DIR/*.BTF

Then any future test that consumes a raw .BTF gets installed for free.

>       @for DIR in $(TEST_INST_SUBDIRS); do                              \
>               mkdir -p $(INSTALL_PATH)/$$DIR;                           \
>               rsync -a $(if $(PERMISSIVE),--ignore-missing-args)        \
> -                     $(OUTPUT)/$$DIR/*.bpf.o                           \
> +                     $(OUTPUT)/$$DIR/*.bpf.o 
> $(OUTPUT)/$$DIR/resolve_btfids.test.o.BTF \
>                       $(INSTALL_PATH)/$$DIR;                            \
>       done
>  endef
> 


Reply via email to