[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f6ad3c63a2de_36578208a2@john-XPS-13-9370.notmuch>
Date: Tue, 22 Sep 2020 21:49:10 -0700
From: John Fastabend <john.fastabend@...il.com>
To: Song Liu <songliubraving@...com>, netdev@...r.kernel.org,
bpf@...r.kernel.org
Cc: kernel-team@...com, ast@...nel.org, daniel@...earbox.net,
john.fastabend@...il.com, kpsingh@...omium.org,
Song Liu <songliubraving@...com>
Subject: RE: [PATCH bpf-next 3/3] selftests/bpf: add raw_tp_test_run
Song Liu wrote:
> This test runs test_run for raw_tracepoint program. The test covers ctx
> input, retval output, and proper handling of cpu_plus field.
>
> Signed-off-by: Song Liu <songliubraving@...com>
> ---
[...]
> +
> + test_attr.ctx_size_in = sizeof(args);
> + err = bpf_prog_test_run_xattr(&test_attr);
> + CHECK(err < 0, "test_run", "err %d\n", errno);
> + CHECK(test_attr.retval != expected_retval, "check_retval",
> + "expect 0x%x, got 0x%x\n", expected_retval, test_attr.retval);
> +
> + for (i = 0; i < nr_online; i++)
> + if (online[i]) {
> + DECLARE_LIBBPF_OPTS(bpf_prog_test_run_opts, opts,
> + .cpu_plus = i + 1,
> + );
> + err = bpf_prog_test_run_xattr_opts(&test_attr, &opts);
> + CHECK(err < 0, "test_run_with_opts", "err %d\n", errno);
> + CHECK(skel->data->on_cpu != i, "check_on_cpu",
> + "got wrong value\n");
Should we also check retval here just to be thorough?
Thanks,
John
> + }
> +cleanup:
> + close(comm_fd);
> + test_raw_tp_test_run__destroy(skel);
> + free(online);
> +}
> diff --git a/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c b/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c
Powered by blists - more mailing lists