mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
selftests/bpf: Migrate from bpf_prog_test_run_xattr
bpf_prog_test_run_xattr is being deprecated in favor of the OPTS-based bpf_prog_test_run_opts. We end up unable to use CHECK_ATTR so replace usages with ASSERT_* calls. Also, prog_run_xattr is now prog_run_opts. Signed-off-by: Delyan Kratunov <delyank@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20220202235423.1097270-3-delyank@fb.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
04fcb5f9a1
commit
3931618378
@@ -140,12 +140,16 @@ out:
|
||||
|
||||
static void test_sockmap_update(enum bpf_map_type map_type)
|
||||
{
|
||||
struct bpf_prog_test_run_attr tattr;
|
||||
int err, prog, src, duration = 0;
|
||||
struct test_sockmap_update *skel;
|
||||
struct bpf_map *dst_map;
|
||||
const __u32 zero = 0;
|
||||
char dummy[14] = {0};
|
||||
LIBBPF_OPTS(bpf_test_run_opts, topts,
|
||||
.data_in = dummy,
|
||||
.data_size_in = sizeof(dummy),
|
||||
.repeat = 1,
|
||||
);
|
||||
__s64 sk;
|
||||
|
||||
sk = connected_socket_v4();
|
||||
@@ -167,16 +171,10 @@ static void test_sockmap_update(enum bpf_map_type map_type)
|
||||
if (CHECK(err, "update_elem(src)", "errno=%u\n", errno))
|
||||
goto out;
|
||||
|
||||
tattr = (struct bpf_prog_test_run_attr){
|
||||
.prog_fd = prog,
|
||||
.repeat = 1,
|
||||
.data_in = dummy,
|
||||
.data_size_in = sizeof(dummy),
|
||||
};
|
||||
|
||||
err = bpf_prog_test_run_xattr(&tattr);
|
||||
if (CHECK_ATTR(err || !tattr.retval, "bpf_prog_test_run",
|
||||
"errno=%u retval=%u\n", errno, tattr.retval))
|
||||
err = bpf_prog_test_run_opts(prog, &topts);
|
||||
if (!ASSERT_OK(err, "test_run"))
|
||||
goto out;
|
||||
if (!ASSERT_NEQ(topts.retval, 0, "test_run retval"))
|
||||
goto out;
|
||||
|
||||
compare_cookies(skel->maps.src, dst_map);
|
||||
|
||||
Reference in New Issue
Block a user