Re: [PATCH v2 bpf-next 11/12] selftests/bpf: use explicit bpf_prog_test_load() calls everywhere

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

 



On 11/3/21 6:08 PM, Andrii Nakryiko wrote:   
> -Dbpf_prog_load_deprecated=bpf_prog_test_load trick is both ugly and
> breaks when deprecation goes into effect due to macro magic. Convert all
> the uses to explicit bpf_prog_test_load() calls which avoid deprecation
> errors and makes everything less magical.
> 
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> ---

[...]

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 5588c622d266..2016c583ed20 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -24,7 +24,6 @@ SAN_CFLAGS	?=
>  CFLAGS += -g -O0 -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS)		\
>  	  -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)		\
>  	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)			\
> -	  -Dbpf_prog_load_deprecated=bpf_prog_test_load			\
>  	  -Dbpf_load_program=bpf_test_load_program
>  LDLIBS += -lcap -lelf -lz -lrt -lpthread
>  

I'm glad that this magic is going away, it's very unintuitive.

That said, I wonder if there's some way to complain loudly if a prog_test uses
bpf_prog_load instead of bpf_prog_test_load. Otherwise will have to manually
guard against it slipping in in some test. This comment applies to patch 12
as well for bpf_load_program.

> @@ -207,6 +206,7 @@ $(OUTPUT)/test_lirc_mode2_user: testing_helpers.o
>  $(OUTPUT)/xdping: testing_helpers.o
>  $(OUTPUT)/flow_dissector_load: testing_helpers.o
>  $(OUTPUT)/test_maps: testing_helpers.o
> +$(OUTPUT)/test_verifier: testing_helpers.o

[...]




[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