Message ID | 0f91336b3f464b63ef2f223bba7759adc81affdb.1719234744.git.tanggeliang@kylinos.cn (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Fixes for BPF selftests on loongarch | expand |
On Mon, 2024-06-24 at 21:27 +0800, Geliang Tang wrote: [...] > diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c > index bceff5900016..8c0306f344e9 100644 > --- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c > +++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c > @@ -411,7 +411,8 @@ static void test_update_ca(void) > return; > > link = bpf_map__attach_struct_ops(skel->maps.ca_update_1); > - ASSERT_OK_PTR(link, "attach_struct_ops"); > + if (!ASSERT_OK_PTR(link, "attach_struct_ops")) > + return; At this point the 'skel' is initialized and needs a call to tcp_ca_update__destroy(). Please add a label at the end of this function and goto there instead of 'return'. Same problem in the rest of the hunks. [...]
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c index bceff5900016..8c0306f344e9 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c @@ -411,7 +411,8 @@ static void test_update_ca(void) return; link = bpf_map__attach_struct_ops(skel->maps.ca_update_1); - ASSERT_OK_PTR(link, "attach_struct_ops"); + if (!ASSERT_OK_PTR(link, "attach_struct_ops")) + return; do_test(&opts); saved_ca1_cnt = skel->bss->ca1_cnt; @@ -447,7 +448,8 @@ static void test_update_wrong(void) return; link = bpf_map__attach_struct_ops(skel->maps.ca_update_1); - ASSERT_OK_PTR(link, "attach_struct_ops"); + if (!ASSERT_OK_PTR(link, "attach_struct_ops")) + return; do_test(&opts); saved_ca1_cnt = skel->bss->ca1_cnt; @@ -484,7 +486,8 @@ static void test_mixed_links(void) ASSERT_OK_PTR(link_nl, "attach_struct_ops_nl"); link = bpf_map__attach_struct_ops(skel->maps.ca_update_1); - ASSERT_OK_PTR(link, "attach_struct_ops"); + if (!ASSERT_OK_PTR(link, "attach_struct_ops")) + return; do_test(&opts); ASSERT_GT(skel->bss->ca1_cnt, 0, "ca1_ca1_cnt"); @@ -536,7 +539,8 @@ static void test_link_replace(void) bpf_link__destroy(link); link = bpf_map__attach_struct_ops(skel->maps.ca_update_2); - ASSERT_OK_PTR(link, "attach_struct_ops_2nd"); + if (!ASSERT_OK_PTR(link, "attach_struct_ops_2nd")) + return; /* BPF_F_REPLACE with a wrong old map Fd. It should fail! *