Skip to content

Commit ee739f1

Browse files
athira-rajeevacmel
authored andcommitted
perf test bpf: Check for libtraceevent support
The "bpf" tests fails in environment with missing libtraceevent support as below: # ./perf test 36 36: BPF filter : 36.1: Basic BPF filtering : FAILED! 36.2: BPF pinning : FAILED! 36.3: BPF prologue generation : FAILED! The environment has clang but missing the libtraceevent devel. Hence perf is compiled without libtraceevent support. Detailed logs: ./perf test -v "Basic BPF filtering" Failed to add BPF event syscalls:sys_enter_epoll_pwait bpf: tracepoint call back failed, stop iterate Failed to add events selected by BPF The bpf tests tris to add probe event which fails at "parse_events_add_tracepoint" function due to missing libtraceevent. Add check for "HAVE_LIBTRACEEVENT" in the "tests/bpf.c" before proceeding with the test. With the change, # ./perf test 36 36: BPF filter : 36.1: Basic BPF filtering : Skip (not compiled in or missing libtraceevent support) 36.2: BPF pinning : Skip (not compiled in or missing libtraceevent support) 36.3: BPF prologue generation : Skip (not compiled in or missing libtraceevent support) Signed-off-by: Athira Jajeev <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Tested-by: Disha Goel <[email protected]> Cc: Andi Kleen <[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: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ab809ef commit ee739f1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/perf/tests/bpf.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define NR_ITERS 111
2424
#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"
2525

26-
#ifdef HAVE_LIBBPF_SUPPORT
26+
#if defined(HAVE_LIBBPF_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
2727
#include <linux/bpf.h>
2828
#include <bpf/bpf.h>
2929

@@ -330,39 +330,39 @@ static int test__bpf(int i)
330330
static int test__basic_bpf_test(struct test_suite *test __maybe_unused,
331331
int subtest __maybe_unused)
332332
{
333-
#ifdef HAVE_LIBBPF_SUPPORT
333+
#if defined(HAVE_LIBBPF_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
334334
return test__bpf(0);
335335
#else
336-
pr_debug("Skip BPF test because BPF support is not compiled\n");
336+
pr_debug("Skip BPF test because BPF or libtraceevent support is not compiled\n");
337337
return TEST_SKIP;
338338
#endif
339339
}
340340

341341
static int test__bpf_pinning(struct test_suite *test __maybe_unused,
342342
int subtest __maybe_unused)
343343
{
344-
#ifdef HAVE_LIBBPF_SUPPORT
344+
#if defined(HAVE_LIBBPF_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
345345
return test__bpf(1);
346346
#else
347-
pr_debug("Skip BPF test because BPF support is not compiled\n");
347+
pr_debug("Skip BPF test because BPF or libtraceevent support is not compiled\n");
348348
return TEST_SKIP;
349349
#endif
350350
}
351351

352352
static int test__bpf_prologue_test(struct test_suite *test __maybe_unused,
353353
int subtest __maybe_unused)
354354
{
355-
#if defined(HAVE_LIBBPF_SUPPORT) && defined(HAVE_BPF_PROLOGUE)
355+
#if defined(HAVE_LIBBPF_SUPPORT) && defined(HAVE_BPF_PROLOGUE) && defined(HAVE_LIBTRACEEVENT)
356356
return test__bpf(2);
357357
#else
358-
pr_debug("Skip BPF test because BPF support is not compiled\n");
358+
pr_debug("Skip BPF test because BPF or libtraceevent support is not compiled\n");
359359
return TEST_SKIP;
360360
#endif
361361
}
362362

363363

364364
static struct test_case bpf_tests[] = {
365-
#ifdef HAVE_LIBBPF_SUPPORT
365+
#if defined(HAVE_LIBBPF_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
366366
TEST_CASE("Basic BPF filtering", basic_bpf_test),
367367
TEST_CASE_REASON("BPF pinning", bpf_pinning,
368368
"clang isn't installed or environment missing BPF support"),
@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = {
373373
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"),
374374
#endif
375375
#else
376-
TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"),
377-
TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"),
378-
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"),
376+
TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"),
377+
TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"),
378+
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"),
379379
#endif
380380
{ .name = NULL, }
381381
};

0 commit comments

Comments
 (0)