diff options
author | 2022-02-02 15:54:21 -0800 | |
---|---|---|
committer | 2022-02-02 22:31:18 -0800 | |
commit | 3931618378451f7ae884b14e4120e07560875cab (patch) | |
tree | fac0cb8e372432a36a23d931b0ccb4646c899db7 /tools/testing/selftests/bpf/prog_tests/test_profiler.c | |
parent | selftests/bpf: Migrate from bpf_prog_test_run (diff) | |
download | linux-dev-3931618378451f7ae884b14e4120e07560875cab.tar.xz linux-dev-3931618378451f7ae884b14e4120e07560875cab.zip |
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
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/test_profiler.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/test_profiler.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/test_profiler.c b/tools/testing/selftests/bpf/prog_tests/test_profiler.c index 4ca275101ee0..de24e8f0e738 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_profiler.c +++ b/tools/testing/selftests/bpf/prog_tests/test_profiler.c @@ -8,20 +8,20 @@ static int sanity_run(struct bpf_program *prog) { - struct bpf_prog_test_run_attr test_attr = {}; + LIBBPF_OPTS(bpf_test_run_opts, test_attr); __u64 args[] = {1, 2, 3}; - __u32 duration = 0; int err, prog_fd; prog_fd = bpf_program__fd(prog); - test_attr.prog_fd = prog_fd; test_attr.ctx_in = args; test_attr.ctx_size_in = sizeof(args); - err = bpf_prog_test_run_xattr(&test_attr); - if (CHECK(err || test_attr.retval, "test_run", - "err %d errno %d retval %d duration %d\n", - err, errno, test_attr.retval, duration)) + err = bpf_prog_test_run_opts(prog_fd, &test_attr); + if (!ASSERT_OK(err, "test_run")) + return -1; + + if (!ASSERT_OK(test_attr.retval, "test_run retval")) return -1; + return 0; } |