summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
diff options
context:
space:
mode:
authorJörn-Thorben Hinz <jthinz@mailbox.tu-berlin.de>2022-06-22 22:12:27 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-06-23 19:49:58 +0300
commitf14a3f644a1c5a2e2dbe6073f51793119a12e6ce (patch)
tree2f2467f86f8349cf645ce153714272a6770c3f7b /tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
parent0735627d78caa56f219dc14608ce0bdbd045e07e (diff)
downloadlinux-f14a3f644a1c5a2e2dbe6073f51793119a12e6ce.tar.xz
selftests/bpf: Test a BPF CC implementing the unsupported get_info()
Test whether a TCP CC implemented in BPF providing get_info() is rejected correctly. get_info() is unsupported in a BPF CC. The check for required functions in a BPF CC has moved, this test ensures unsupported functions are still rejected correctly. Signed-off-by: Jörn-Thorben Hinz <jthinz@mailbox.tu-berlin.de> Reviewed-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/r/20220622191227.898118-6-jthinz@mailbox.tu-berlin.de Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c20
1 files changed, 20 insertions, 0 deletions
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 194d07310531..2959a52ced06 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -11,6 +11,7 @@
#include "bpf_dctcp_release.skel.h"
#include "tcp_ca_write_sk_pacing.skel.h"
#include "tcp_ca_incompl_cong_ops.skel.h"
+#include "tcp_ca_unsupp_cong_op.skel.h"
#ifndef ENOTSUPP
#define ENOTSUPP 524
@@ -359,6 +360,23 @@ static void test_incompl_cong_ops(void)
tcp_ca_incompl_cong_ops__destroy(skel);
}
+static void test_unsupp_cong_op(void)
+{
+ libbpf_print_fn_t old_print_fn;
+ struct tcp_ca_unsupp_cong_op *skel;
+
+ err_str = "attach to unsupported member get_info";
+ found = false;
+ old_print_fn = libbpf_set_print(libbpf_debug_print);
+
+ skel = tcp_ca_unsupp_cong_op__open_and_load();
+ ASSERT_NULL(skel, "open_and_load");
+ ASSERT_EQ(found, true, "expected_err_msg");
+
+ tcp_ca_unsupp_cong_op__destroy(skel);
+ libbpf_set_print(old_print_fn);
+}
+
void test_bpf_tcp_ca(void)
{
if (test__start_subtest("dctcp"))
@@ -375,4 +393,6 @@ void test_bpf_tcp_ca(void)
test_write_sk_pacing();
if (test__start_subtest("incompl_cong_ops"))
test_incompl_cong_ops();
+ if (test__start_subtest("unsupp_cong_op"))
+ test_unsupp_cong_op();
}