Message ID | 28e7af7c031557f691dc8045ee41dd549dd5e74c.1706131762.git.pabeni@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 98cb12eb52a780e682bea8372fdb2912c08132dd |
Headers | show |
Series | selftests: net: a few fixes | expand |
Paolo Abeni wrote: > Several net tests requires an XDP program build under the ebpf > directory, and error out if such program is not available. > > That makes running successful net test hard, let's duplicate into the > net dir the [very small] program, re-using the existing rules to build > it, and finally dropping the bogus dependency. > > Signed-off-by: Paolo Abeni <pabeni@redhat.com> > --- > tools/testing/selftests/net/Makefile | 5 +++-- > tools/testing/selftests/net/udpgro.sh | 4 ++-- > tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- > tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- > tools/testing/selftests/net/udpgro_fwd.sh | 2 +- > tools/testing/selftests/net/veth.sh | 4 ++-- > tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ > 7 files changed, 26 insertions(+), 12 deletions(-) > create mode 100644 tools/testing/selftests/net/xdp_dummy.c > > diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile > index 50818075e566..304d8b852ef0 100644 > --- a/tools/testing/selftests/net/Makefile > +++ b/tools/testing/selftests/net/Makefile > @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh > TEST_GEN_FILES += sctp_hello > TEST_GEN_FILES += csum > TEST_GEN_FILES += nat6to4.o > +TEST_GEN_FILES += xdp_dummy.o > TEST_GEN_FILES += ip_local_port_range > TEST_GEN_FILES += bind_wildcard > TEST_PROGS += test_vxlan_mdb.sh > @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread > $(OUTPUT)/bind_bhash: LDLIBS += -lpthread > $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ > > -# Rules to generate bpf obj nat6to4.o > +# Rules to generate bpf objs > CLANG ?= clang > SCRATCH_DIR := $(OUTPUT)/tools > BUILD_DIR := $(SCRATCH_DIR)/build > @@ -139,7 +140,7 @@ endif > > CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) > > -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) > +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) > $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ is the "$(OUTPUT)/%.o :" intentional or a leftover from editing?
On Wed, 2024-01-24 at 20:10 -0500, Willem de Bruijn wrote: > Paolo Abeni wrote: > > Several net tests requires an XDP program build under the ebpf > > directory, and error out if such program is not available. > > > > That makes running successful net test hard, let's duplicate into the > > net dir the [very small] program, re-using the existing rules to build > > it, and finally dropping the bogus dependency. > > > > Signed-off-by: Paolo Abeni <pabeni@redhat.com> > > --- > > tools/testing/selftests/net/Makefile | 5 +++-- > > tools/testing/selftests/net/udpgro.sh | 4 ++-- > > tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- > > tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- > > tools/testing/selftests/net/udpgro_fwd.sh | 2 +- > > tools/testing/selftests/net/veth.sh | 4 ++-- > > tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ > > 7 files changed, 26 insertions(+), 12 deletions(-) > > create mode 100644 tools/testing/selftests/net/xdp_dummy.c > > > > diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile > > index 50818075e566..304d8b852ef0 100644 > > --- a/tools/testing/selftests/net/Makefile > > +++ b/tools/testing/selftests/net/Makefile > > @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh > > TEST_GEN_FILES += sctp_hello > > TEST_GEN_FILES += csum > > TEST_GEN_FILES += nat6to4.o > > +TEST_GEN_FILES += xdp_dummy.o > > TEST_GEN_FILES += ip_local_port_range > > TEST_GEN_FILES += bind_wildcard > > TEST_PROGS += test_vxlan_mdb.sh > > @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread > > $(OUTPUT)/bind_bhash: LDLIBS += -lpthread > > $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ > > > > -# Rules to generate bpf obj nat6to4.o > > +# Rules to generate bpf objs > > CLANG ?= clang > > SCRATCH_DIR := $(OUTPUT)/tools > > BUILD_DIR := $(SCRATCH_DIR)/build > > @@ -139,7 +140,7 @@ endif > > > > CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) > > > > -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) > > +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) > > $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ > > is the "$(OUTPUT)/%.o :" intentional or a leftover from editing? Is intentional and AFAICS required to let this rule being selected when the output directory is not an empty string (the target and the pre-req will be in different directories). Cheers, Paolo
Paolo Abeni wrote: > On Wed, 2024-01-24 at 20:10 -0500, Willem de Bruijn wrote: > > Paolo Abeni wrote: > > > Several net tests requires an XDP program build under the ebpf > > > directory, and error out if such program is not available. > > > > > > That makes running successful net test hard, let's duplicate into the > > > net dir the [very small] program, re-using the existing rules to build > > > it, and finally dropping the bogus dependency. > > > > > > Signed-off-by: Paolo Abeni <pabeni@redhat.com> > > > --- > > > tools/testing/selftests/net/Makefile | 5 +++-- > > > tools/testing/selftests/net/udpgro.sh | 4 ++-- > > > tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- > > > tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- > > > tools/testing/selftests/net/udpgro_fwd.sh | 2 +- > > > tools/testing/selftests/net/veth.sh | 4 ++-- > > > tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ > > > 7 files changed, 26 insertions(+), 12 deletions(-) > > > create mode 100644 tools/testing/selftests/net/xdp_dummy.c > > > > > > diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile > > > index 50818075e566..304d8b852ef0 100644 > > > --- a/tools/testing/selftests/net/Makefile > > > +++ b/tools/testing/selftests/net/Makefile > > > @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh > > > TEST_GEN_FILES += sctp_hello > > > TEST_GEN_FILES += csum > > > TEST_GEN_FILES += nat6to4.o > > > +TEST_GEN_FILES += xdp_dummy.o > > > TEST_GEN_FILES += ip_local_port_range > > > TEST_GEN_FILES += bind_wildcard > > > TEST_PROGS += test_vxlan_mdb.sh > > > @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread > > > $(OUTPUT)/bind_bhash: LDLIBS += -lpthread > > > $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ > > > > > > -# Rules to generate bpf obj nat6to4.o > > > +# Rules to generate bpf objs > > > CLANG ?= clang > > > SCRATCH_DIR := $(OUTPUT)/tools > > > BUILD_DIR := $(SCRATCH_DIR)/build > > > @@ -139,7 +140,7 @@ endif > > > > > > CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) > > > > > > -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) > > > +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) > > > $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ > > > > is the "$(OUTPUT)/%.o :" intentional or a leftover from editing? > > Is intentional and AFAICS required to let this rule being selected when > the output directory is not an empty string (the target and the pre-req > will be in different directories). Thanks. I don't understand why. Sorry to harp on this small point, but you've verified that the build fails without? Is it perhaps due to that "$(MAKE_DIRS)" order-only-prerequisite? But nat6to4 on its own did not need this. Substition references could add a second colon in a rule, but otherwise I cannot find a reference to this repeated colon syntax. Don't waste time on my behalf if you're sure this is correct. I just can't add a reviewed tag if I don't understand it -- but that tag is hardly essential.
On Thu, 2024-01-25 at 09:27 -0500, Willem de Bruijn wrote: > Paolo Abeni wrote: > > On Wed, 2024-01-24 at 20:10 -0500, Willem de Bruijn wrote: > > > Paolo Abeni wrote: > > > > Several net tests requires an XDP program build under the ebpf > > > > directory, and error out if such program is not available. > > > > > > > > That makes running successful net test hard, let's duplicate into the > > > > net dir the [very small] program, re-using the existing rules to build > > > > it, and finally dropping the bogus dependency. > > > > > > > > Signed-off-by: Paolo Abeni <pabeni@redhat.com> > > > > --- > > > > tools/testing/selftests/net/Makefile | 5 +++-- > > > > tools/testing/selftests/net/udpgro.sh | 4 ++-- > > > > tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- > > > > tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- > > > > tools/testing/selftests/net/udpgro_fwd.sh | 2 +- > > > > tools/testing/selftests/net/veth.sh | 4 ++-- > > > > tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ > > > > 7 files changed, 26 insertions(+), 12 deletions(-) > > > > create mode 100644 tools/testing/selftests/net/xdp_dummy.c > > > > > > > > diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile > > > > index 50818075e566..304d8b852ef0 100644 > > > > --- a/tools/testing/selftests/net/Makefile > > > > +++ b/tools/testing/selftests/net/Makefile > > > > @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh > > > > TEST_GEN_FILES += sctp_hello > > > > TEST_GEN_FILES += csum > > > > TEST_GEN_FILES += nat6to4.o > > > > +TEST_GEN_FILES += xdp_dummy.o > > > > TEST_GEN_FILES += ip_local_port_range > > > > TEST_GEN_FILES += bind_wildcard > > > > TEST_PROGS += test_vxlan_mdb.sh > > > > @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread > > > > $(OUTPUT)/bind_bhash: LDLIBS += -lpthread > > > > $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ > > > > > > > > -# Rules to generate bpf obj nat6to4.o > > > > +# Rules to generate bpf objs > > > > CLANG ?= clang > > > > SCRATCH_DIR := $(OUTPUT)/tools > > > > BUILD_DIR := $(SCRATCH_DIR)/build > > > > @@ -139,7 +140,7 @@ endif > > > > > > > > CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) > > > > > > > > -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) > > > > +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) > > > > $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ > > > > > > is the "$(OUTPUT)/%.o :" intentional or a leftover from editing? > > > > Is intentional and AFAICS required to let this rule being selected when > > the output directory is not an empty string (the target and the pre-req > > will be in different directories). > > Thanks. I don't understand why. Sorry to harp on this small point, but > you've verified that the build fails without? Is it perhaps due to that > "$(MAKE_DIRS)" order-only-prerequisite? But nat6to4 on its own did not > need this. I tried quite a bit of permutation (all others failing) before selecting this one (shame on me, with a stackoverflow hint [!!!]). But I finally found the relevant documentation reference: https://www.gnu.org/software/make/manual/make.html#Static-Pattern A simpler wildcard rule would not be enough, as the already existing wildcard used to build plain c files will take precedence. nat6to4 did not need this fancy syntax, as it was a simple, single target single pre-req rule - that takes precedence on the mentioned wildcard. Please let me know if the above clarifies a bit the scenario. Cheers, Paolo
Paolo Abeni wrote: > On Thu, 2024-01-25 at 09:27 -0500, Willem de Bruijn wrote: > > Paolo Abeni wrote: > > > On Wed, 2024-01-24 at 20:10 -0500, Willem de Bruijn wrote: > > > > Paolo Abeni wrote: > > > > > Several net tests requires an XDP program build under the ebpf > > > > > directory, and error out if such program is not available. > > > > > > > > > > That makes running successful net test hard, let's duplicate into the > > > > > net dir the [very small] program, re-using the existing rules to build > > > > > it, and finally dropping the bogus dependency. > > > > > > > > > > Signed-off-by: Paolo Abeni <pabeni@redhat.com> > > > > > --- > > > > > tools/testing/selftests/net/Makefile | 5 +++-- > > > > > tools/testing/selftests/net/udpgro.sh | 4 ++-- > > > > > tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- > > > > > tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- > > > > > tools/testing/selftests/net/udpgro_fwd.sh | 2 +- > > > > > tools/testing/selftests/net/veth.sh | 4 ++-- > > > > > tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ > > > > > 7 files changed, 26 insertions(+), 12 deletions(-) > > > > > create mode 100644 tools/testing/selftests/net/xdp_dummy.c > > > > > > > > > > diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile > > > > > index 50818075e566..304d8b852ef0 100644 > > > > > --- a/tools/testing/selftests/net/Makefile > > > > > +++ b/tools/testing/selftests/net/Makefile > > > > > @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh > > > > > TEST_GEN_FILES += sctp_hello > > > > > TEST_GEN_FILES += csum > > > > > TEST_GEN_FILES += nat6to4.o > > > > > +TEST_GEN_FILES += xdp_dummy.o > > > > > TEST_GEN_FILES += ip_local_port_range > > > > > TEST_GEN_FILES += bind_wildcard > > > > > TEST_PROGS += test_vxlan_mdb.sh > > > > > @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread > > > > > $(OUTPUT)/bind_bhash: LDLIBS += -lpthread > > > > > $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ > > > > > > > > > > -# Rules to generate bpf obj nat6to4.o > > > > > +# Rules to generate bpf objs > > > > > CLANG ?= clang > > > > > SCRATCH_DIR := $(OUTPUT)/tools > > > > > BUILD_DIR := $(SCRATCH_DIR)/build > > > > > @@ -139,7 +140,7 @@ endif > > > > > > > > > > CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) > > > > > > > > > > -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) > > > > > +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) > > > > > $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ > > > > > > > > is the "$(OUTPUT)/%.o :" intentional or a leftover from editing? > > > > > > Is intentional and AFAICS required to let this rule being selected when > > > the output directory is not an empty string (the target and the pre-req > > > will be in different directories). > > > > Thanks. I don't understand why. Sorry to harp on this small point, but > > you've verified that the build fails without? Is it perhaps due to that > > "$(MAKE_DIRS)" order-only-prerequisite? But nat6to4 on its own did not > > need this. > > I tried quite a bit of permutation (all others failing) before > selecting this one (shame on me, with a stackoverflow hint [!!!]). > > But I finally found the relevant documentation reference: > > https://www.gnu.org/software/make/manual/make.html#Static-Pattern > > A simpler wildcard rule would not be enough, as the already existing > wildcard used to build plain c files will take precedence. > > nat6to4 did not need this fancy syntax, as it was a simple, single > target single pre-req rule - that takes precedence on the mentioned > wildcard. > > Please let me know if the above clarifies a bit the scenario. Reviewed-by: Willem de Bruijn <willemb@google.com> Thanks for looking that up! So the wildcard is needed for the %.c in the new rule. Makes sense.
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 50818075e566..304d8b852ef0 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh TEST_GEN_FILES += sctp_hello TEST_GEN_FILES += csum TEST_GEN_FILES += nat6to4.o +TEST_GEN_FILES += xdp_dummy.o TEST_GEN_FILES += ip_local_port_range TEST_GEN_FILES += bind_wildcard TEST_PROGS += test_vxlan_mdb.sh @@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread $(OUTPUT)/bind_bhash: LDLIBS += -lpthread $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ -# Rules to generate bpf obj nat6to4.o +# Rules to generate bpf objs CLANG ?= clang SCRATCH_DIR := $(OUTPUT)/tools BUILD_DIR := $(SCRATCH_DIR)/build @@ -139,7 +140,7 @@ endif CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \ diff --git a/tools/testing/selftests/net/udpgro.sh b/tools/testing/selftests/net/udpgro.sh index af5dc57c8ce9..8802604148dd 100755 --- a/tools/testing/selftests/net/udpgro.sh +++ b/tools/testing/selftests/net/udpgro.sh @@ -7,7 +7,7 @@ source net_helper.sh readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" # set global exit status, but never reset nonzero one. check_err() @@ -197,7 +197,7 @@ run_all() { } if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit -1 fi diff --git a/tools/testing/selftests/net/udpgro_bench.sh b/tools/testing/selftests/net/udpgro_bench.sh index cb664679b434..7080eae5312b 100755 --- a/tools/testing/selftests/net/udpgro_bench.sh +++ b/tools/testing/selftests/net/udpgro_bench.sh @@ -7,7 +7,7 @@ source net_helper.sh readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" cleanup() { local -r jobs="$(jobs -p)" @@ -84,7 +84,7 @@ run_all() { } if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit -1 fi diff --git a/tools/testing/selftests/net/udpgro_frglist.sh b/tools/testing/selftests/net/udpgro_frglist.sh index dd47fa96f6b3..e1ff645bd3d1 100755 --- a/tools/testing/selftests/net/udpgro_frglist.sh +++ b/tools/testing/selftests/net/udpgro_frglist.sh @@ -7,7 +7,7 @@ source net_helper.sh readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" cleanup() { local -r jobs="$(jobs -p)" @@ -85,12 +85,12 @@ run_all() { } if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit -1 fi if [ ! -f nat6to4.o ]; then - echo "Missing nat6to4 helper. Build bpf nat6to4.o selftest first" + echo "Missing nat6to4 helper. Run 'make' first" exit -1 fi diff --git a/tools/testing/selftests/net/udpgro_fwd.sh b/tools/testing/selftests/net/udpgro_fwd.sh index c079565add39..5fa8659ab13d 100755 --- a/tools/testing/selftests/net/udpgro_fwd.sh +++ b/tools/testing/selftests/net/udpgro_fwd.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" readonly BASE="ns-$(mktemp -u XXXXXX)" readonly SRC=2 readonly DST=1 diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 2d073595c620..27574bbf2d63 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" readonly STATS="$(mktemp -p /tmp ns-XXXXXX)" readonly BASE=`basename $STATS` readonly SRC=2 @@ -218,7 +218,7 @@ while getopts "hs:" option; do done if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit 1 fi diff --git a/tools/testing/selftests/net/xdp_dummy.c b/tools/testing/selftests/net/xdp_dummy.c new file mode 100644 index 000000000000..d988b2e0cee8 --- /dev/null +++ b/tools/testing/selftests/net/xdp_dummy.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +#define KBUILD_MODNAME "xdp_dummy" +#include <linux/bpf.h> +#include <bpf/bpf_helpers.h> + +SEC("xdp") +int xdp_dummy_prog(struct xdp_md *ctx) +{ + return XDP_PASS; +} + +char _license[] SEC("license") = "GPL";
Several net tests requires an XDP program build under the ebpf directory, and error out if such program is not available. That makes running successful net test hard, let's duplicate into the net dir the [very small] program, re-using the existing rules to build it, and finally dropping the bogus dependency. Signed-off-by: Paolo Abeni <pabeni@redhat.com> --- tools/testing/selftests/net/Makefile | 5 +++-- tools/testing/selftests/net/udpgro.sh | 4 ++-- tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- tools/testing/selftests/net/udpgro_fwd.sh | 2 +- tools/testing/selftests/net/veth.sh | 4 ++-- tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ 7 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 tools/testing/selftests/net/xdp_dummy.c