Message ID | 20210819072431.21966-3-lizhijian@cn.fujitsu.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/3] selftests/bpf: make test_doc_build.sh work from script directory | expand |
On Thu, Aug 19, 2021 at 12:28 AM Li Zhijian <lizhijian@cn.fujitsu.com> wrote: > > - 'make install' will install bpftool to INSTALL_PATH/bpf/bpftool > - add INSTALL_PATH/bpf to PATH > > Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> Acked-by: Song Liu <songliubraving@fb.com> With one nit below: > --- > tools/testing/selftests/bpf/Makefile | 4 +++- > tools/testing/selftests/bpf/test_bpftool.sh | 3 ++- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index f405b20c1e6c..c6ca1b8e33d5 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -85,7 +85,7 @@ TEST_PROGS_EXTENDED := with_addr.sh \ > TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ > flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ > test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \ > - xdpxceiver xdp_redirect_multi > + xdpxceiver xdp_redirect_multi test_bpftool.py > > TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read > > @@ -187,6 +187,8 @@ $(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL) > BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR) && \ > cp $(SCRATCH_DIR)/runqslower $@ > > +TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL) > + > $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ) > > $(OUTPUT)/test_dev_cgroup: cgroup_helpers.c > diff --git a/tools/testing/selftests/bpf/test_bpftool.sh b/tools/testing/selftests/bpf/test_bpftool.sh > index 6b7ba19be1d0..50cf9d3645d2 100755 > --- a/tools/testing/selftests/bpf/test_bpftool.sh > +++ b/tools/testing/selftests/bpf/test_bpftool.sh > @@ -2,9 +2,10 @@ > # SPDX-License-Identifier: GPL-2.0 > # Copyright (c) 2020 SUSE LLC. > > +# 'make -C tools/testing/selftests/bpf install' will install to SCRIPT_PATH nit: Should be SCRIPT_DIR. ^^^^^ > SCRIPT_DIR=$(dirname $(realpath $0)) > > # 'make -C tools/testing/selftests/bpf' will install to BPFTOOL_INSTALL_PATH > BPFTOOL_INSTALL_PATH="$SCRIPT_DIR"/tools/sbin > -export PATH=$BPFTOOL_INSTALL_PATH:$PATH > +export PATH=$SCRIPT_DIR:$BPFTOOL_INSTALL_PATH:$PATH > python3 -m unittest -v test_bpftool.TestBpftool > -- > 2.32.0 > > >
On 20/08/2021 06:16, Song Liu wrote: > On Thu, Aug 19, 2021 at 12:28 AM Li Zhijian <lizhijian@cn.fujitsu.com> wrote: >> - 'make install' will install bpftool to INSTALL_PATH/bpf/bpftool >> - add INSTALL_PATH/bpf to PATH >> >> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> > Acked-by: Song Liu <songliubraving@fb.com> > > With one nit below: thanks for your review, i just submit a V2 to fix it and Change-log: V2: - folded previous similar standalone patch to [1/5], and add acked tagĀ from Song Liu - add acked tag to [2/5], [3/5] from Song Liu - [4/5]: move test_bpftool.py to TEST_PROGS_EXTENDED, files in TEST_GEN_PROGS_EXTENDED are generated by make. Otherwise, it will break out-of-tree install: 'make O=/kselftest-build SKIP_TARGETS= V=1 -C tools/testing/selftests install INSTALL_PATH=/kselftest-install' - [5/5]: new patch Please take a look. Thanks Zhijian > >> --- >> tools/testing/selftests/bpf/Makefile | 4 +++- >> tools/testing/selftests/bpf/test_bpftool.sh | 3 ++- >> 2 files changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile >> index f405b20c1e6c..c6ca1b8e33d5 100644 >> --- a/tools/testing/selftests/bpf/Makefile >> +++ b/tools/testing/selftests/bpf/Makefile >> @@ -85,7 +85,7 @@ TEST_PROGS_EXTENDED := with_addr.sh \ >> TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ >> flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ >> test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \ >> - xdpxceiver xdp_redirect_multi >> + xdpxceiver xdp_redirect_multi test_bpftool.py >> >> TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read >> >> @@ -187,6 +187,8 @@ $(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL) >> BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR) && \ >> cp $(SCRATCH_DIR)/runqslower $@ >> >> +TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL) >> + >> $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ) >> >> $(OUTPUT)/test_dev_cgroup: cgroup_helpers.c >> diff --git a/tools/testing/selftests/bpf/test_bpftool.sh b/tools/testing/selftests/bpf/test_bpftool.sh >> index 6b7ba19be1d0..50cf9d3645d2 100755 >> --- a/tools/testing/selftests/bpf/test_bpftool.sh >> +++ b/tools/testing/selftests/bpf/test_bpftool.sh >> @@ -2,9 +2,10 @@ >> # SPDX-License-Identifier: GPL-2.0 >> # Copyright (c) 2020 SUSE LLC. >> >> +# 'make -C tools/testing/selftests/bpf install' will install to SCRIPT_PATH > nit: Should be SCRIPT_DIR. ^^^^^ > >> SCRIPT_DIR=$(dirname $(realpath $0)) >> >> # 'make -C tools/testing/selftests/bpf' will install to BPFTOOL_INSTALL_PATH >> BPFTOOL_INSTALL_PATH="$SCRIPT_DIR"/tools/sbin >> -export PATH=$BPFTOOL_INSTALL_PATH:$PATH >> +export PATH=$SCRIPT_DIR:$BPFTOOL_INSTALL_PATH:$PATH >> python3 -m unittest -v test_bpftool.TestBpftool >> -- >> 2.32.0 >> >> >> >
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index f405b20c1e6c..c6ca1b8e33d5 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -85,7 +85,7 @@ TEST_PROGS_EXTENDED := with_addr.sh \ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \ - xdpxceiver xdp_redirect_multi + xdpxceiver xdp_redirect_multi test_bpftool.py TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read @@ -187,6 +187,8 @@ $(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL) BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR) && \ cp $(SCRATCH_DIR)/runqslower $@ +TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL) + $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ) $(OUTPUT)/test_dev_cgroup: cgroup_helpers.c diff --git a/tools/testing/selftests/bpf/test_bpftool.sh b/tools/testing/selftests/bpf/test_bpftool.sh index 6b7ba19be1d0..50cf9d3645d2 100755 --- a/tools/testing/selftests/bpf/test_bpftool.sh +++ b/tools/testing/selftests/bpf/test_bpftool.sh @@ -2,9 +2,10 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2020 SUSE LLC. +# 'make -C tools/testing/selftests/bpf install' will install to SCRIPT_PATH SCRIPT_DIR=$(dirname $(realpath $0)) # 'make -C tools/testing/selftests/bpf' will install to BPFTOOL_INSTALL_PATH BPFTOOL_INSTALL_PATH="$SCRIPT_DIR"/tools/sbin -export PATH=$BPFTOOL_INSTALL_PATH:$PATH +export PATH=$SCRIPT_DIR:$BPFTOOL_INSTALL_PATH:$PATH python3 -m unittest -v test_bpftool.TestBpftool
- 'make install' will install bpftool to INSTALL_PATH/bpf/bpftool - add INSTALL_PATH/bpf to PATH Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> --- tools/testing/selftests/bpf/Makefile | 4 +++- tools/testing/selftests/bpf/test_bpftool.sh | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)