Skip to content

Commit 34266f9

Browse files
athira-rajeevacmel
authored andcommitted
perf test bpf: Skip test if kernel-debuginfo is not present
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 the subtest "BPF prologue generation" failed and logs shows debuginfo is needed. After installing kernel-debuginfo package, testcase passes. The "BPF prologue generation" subtest failed because, the do_test() returns TEST_FAIL without checking the error type returned by parse_events_load_bpf_obj(). parse_events_load_bpf_obj() can also return error of type -ENODATA incase kernel-debuginfo package is not installed. Fix this by adding check for -ENODATA 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: ba1fae4 ("perf test: Add 'perf test BPF'") Signed-off-by: Athira Rajeev <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Disha Goel <[email protected]> Cc: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nageswara R Sastry <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Cc: [email protected] Link: http://lore.kernel.org/linux-perf-users/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 67ef66b commit 34266f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/perf/tests/bpf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
126126

127127
err = parse_events_load_bpf_obj(&parse_state, &parse_state.list, obj, NULL);
128128
parse_events_error__exit(&parse_error);
129+
if (err == -ENODATA) {
130+
pr_debug("Failed to add events selected by BPF, debuginfo package not installed\n");
131+
return TEST_SKIP;
132+
}
129133
if (err || list_empty(&parse_state.list)) {
130134
pr_debug("Failed to add events selected by BPF\n");
131135
return TEST_FAIL;
@@ -368,7 +372,7 @@ static struct test_case bpf_tests[] = {
368372
"clang isn't installed or environment missing BPF support"),
369373
#ifdef HAVE_BPF_PROLOGUE
370374
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test,
371-
"clang isn't installed or environment missing BPF support"),
375+
"clang/debuginfo isn't installed or environment missing BPF support"),
372376
#else
373377
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"),
374378
#endif

0 commit comments

Comments
 (0)