[PATCH] perf test bpf: Skip test if kernel-debuginfo is not present
Athira Rajeev
atrajeev at linux.vnet.ibm.com
Thu Nov 3 17:57:01 AEDT 2022
> On 28-Oct-2022, at 9:12 PM, Kajol Jain <kjain at linux.ibm.com> wrote:
>
> Perf BPF filter test fails in environment where "kernel-debuginfo"
> is not installed.
>
> Test failure logs:
> <<>>
> 42: BPF filter :
> 42.1: Basic BPF filtering : Ok
> 42.2: BPF pinning : Ok
> 42.3: BPF prologue generation : FAILED!
> <<>>
>
> Enabling verbose option provided debug logs, which says debuginfo
> needs to be installed. Snippet of verbose logs:
>
> <<>>
> 42.3: BPF prologue generation :
> --- start ---
> test child forked, pid 28218
> <<>>
> Rebuild with CONFIG_DEBUG_INFO=y, or install an appropriate debuginfo
> package.
> bpf_probe: failed to convert perf probe events
> Failed to add events selected by BPF
> test child finished with -1
> ---- end ----
> BPF filter subtest 3: FAILED!
> <<>>
>
> Here subtest, "BPF prologue generation" failed and
> logs shows debuginfo is needed. After installing
> kernel-debuginfo package, testcase passes.
>
> Subtest "BPF prologue generation" failed because, the "do_test"
> function returns "TEST_FAIL" without checking the error type
> returned by "parse_events_load_bpf_obj" function.
> Function parse_events_load_bpf_obj can also return error of type
> "-ENOENT" incase kernel-debuginfo package is not installed. Fix this
> by adding check for -ENOENT error.
>
> Test result after the patch changes:
>
> Test failure logs:
> <<>>
> 42: BPF filter :
> 42.1: Basic BPF filtering : Ok
> 42.2: BPF pinning : Ok
> 42.3: BPF prologue generation : Skip (clang/debuginfo isn't
> installed or environment missing BPF support)
>
> Fixes: ba1fae431e74bb42 ("perf test: Add 'perf test BPF'")
> Signed-off-by: Kajol Jain <kjain at linux.ibm.com>
> Reviewed-by: Madhavan Srinivasan <maddy at linux.ibm.com>
> ---
> tools/perf/tests/bpf.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
> index 17c023823713..57cecadc1da2 100644
> --- a/tools/perf/tests/bpf.c
> +++ b/tools/perf/tests/bpf.c
> @@ -126,6 +126,10 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
>
> err = parse_events_load_bpf_obj(&parse_state, &parse_state.list, obj, NULL);
> parse_events_error__exit(&parse_error);
> + if (err == -ENOENT) {
> + pr_debug("Failed to add events selected by BPF, debuginfo package not installed\n");
> + return TEST_SKIP;
> + }
Hi Kajol,
Here, you have used ENOENT to skip the test. But there could be other places in the code path for “parse_events_load_bpf_obj”
which also returns ENOENT. In that case, for any exit that returns ENOENT, test will get skipped.
Can we look at the logs, example we have this in commit logs:
Rebuild with CONFIG_DEBUG_INFO=y, or install an appropriate debuginfo
package.
so as to decide whether to skip for debug info ?
Thanks
Athira
> if (err || list_empty(&parse_state.list)) {
> pr_debug("Failed to add events selected by BPF\n");
> return TEST_FAIL;
> @@ -368,7 +372,7 @@ static struct test_case bpf_tests[] = {
> "clang isn't installed or environment missing BPF support"),
> #ifdef HAVE_BPF_PROLOGUE
> TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test,
> - "clang isn't installed or environment missing BPF support"),
> + "clang/debuginfo isn't installed or environment missing BPF support"),
> #else
> TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"),
> #endif
> --
> 2.31.1
>
More information about the Linuxppc-dev
mailing list