Skip to contentSkip to conversation

selftests/bpf: Move test_lwt_ip_encap to test_progs

PATCH In review Bastien Curutchet (eBPF Foundation) 2 participants 2 messages Mar 4, 2025 – Mar 6, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: Move test_lwt_ip_encap to test_progs

test_lwt_ip_encap.sh isn't used by the BPF CI.

Add a new file in the test_progs framework to migrate the tests done by test_lwt_ip_encap.sh. It uses the same network topology and the same BPF programs located in progs/test_lwt_ip_encap.c.
Rework the GSO part to avoid using nc and dd.

Remove test_lwt_ip_encap.sh and its Makefile entry.

---
 tools/testing/selftests/bpf/Makefile               |   3 +-
 .../selftests/bpf/prog_tests/lwt_ip_encap.c        | 540 +++++++++++++++++++++
 tools/testing/selftests/bpf/test_lwt_ip_encap.sh   | 476 ------------------
 3 files changed, 541 insertions(+), 478 deletions(-)
tools/testing/selftests/bpf/Makefile +1 -2
index e6a02d5b87d123cef7e6b41bfbc96d34083f38e1..df4814b5200a5a0e732b19ab3a5975957fb7cbc9 100644
@@ -95,7 +95,7 @@ TEST_GEN_PROGS += test_progs-cpuv4
 TEST_INST_SUBDIRS += cpuv4
 endif
 
-TEST_GEN_FILES = test_lwt_ip_encap.bpf.o test_tc_edt.bpf.o
+TEST_GEN_FILES = test_tc_edt.bpf.o
 TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c)
 
 # Order correspond to 'make run_tests' order
@@ -104,7 +104,6 @@ TEST_PROGS := test_kmod.sh \
 	test_lirc_mode2.sh \
 	test_xdp_vlan_mode_generic.sh \
 	test_xdp_vlan_mode_native.sh \
-	test_lwt_ip_encap.sh \
 	test_tc_tunnel.sh \
 	test_tc_edt.sh \
 	test_xdping.sh \
tools/testing/selftests/bpf/prog_tests/lwt_ip_encap.c new file +540 -0

540 lines not on this page · raw message

tools/testing/selftests/bpf/test_lwt_ip_encap.sh deleted +0 -476

476 lines not on this page · raw message

---
base-commit: 5fd21aaac37919abc5c5d0df1eb06a9f02518f27
change-id: 20250206-lwt_ip-b6a91d2787bf

Best regards,

Signature · 1 line
Bastien Curutchet (eBPF Foundation) <[email protected]>
#1 lore raw
Quoted 13 lines · Bastien Curutchet (eBPF Foundation)
tools/testing/selftests/bpf/prog_tests/lwt_ip_encap.c new file +13 -0
+int remove_routes_to_gredev(const char *ns1, const char *ns2, const char *vrf)
+{
+	SYS(fail, "ip -n %s route del %s dev veth5 %s", ns1, IP4_ADDR_GRE, vrf);
+	SYS(fail, "ip -n %s route del %s dev veth7 %s", ns2, IP4_ADDR_GRE, vrf);
+	SYS(fail, "ip -n %s -6 route del %s/128 dev veth5 %s", ns1, IP6_ADDR_GRE, vrf);
+	SYS(fail, "ip -n %s -6 route del %s/128 dev veth7 %s", ns2, IP6_ADDR_GRE, vrf);
+
+	return 0;
+fail:
+	return -1;
+}
+
+int add_unreachable_routes_to_gredev(const char *ns1, const char *ns2, const char *vrf)

tools/testing/selftests/bpf/prog_tests/lwt_ip_encap.c line 340

Quoted 10 lines
tools/testing/selftests/bpf/prog_tests/lwt_ip_encap.c new file +10 -0
+{
+	SYS(fail, "ip -n %s route add unreachable %s/32 %s", ns1, IP4_ADDR_GRE, vrf);
+	SYS(fail, "ip -n %s route add unreachable %s/32 %s", ns2, IP4_ADDR_GRE, vrf);
+	SYS(fail, "ip -n %s -6 route add unreachable %s/128 %s", ns1, IP6_ADDR_GRE, vrf);
+	SYS(fail, "ip -n %s -6 route add unreachable %s/128 %s", ns2, IP6_ADDR_GRE, vrf);
+
+	return 0;
+fail:
+	return -1;
+}

Added static to these two functions and applied. Thanks.