tests/bpf: Fix the bpf test to check for libtraceevent support
PATCH 1/1 tests/bpf: Fix the bpf test to check for libtraceevent support
"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)
--- tools/perf/tests/bpf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
tools/perf/tests/bpf.c +11 -11
@@ -23,7 +23,7 @@#define NR_ITERS 111#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )#include <linux/bpf.h> #include <bpf/bpf.h>
@@ -330,10 +330,10 @@ static int test__bpf(int i)static int test__basic_bpf_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (0 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }
@@ -341,10 +341,10 @@ static int test__basic_bpf_test(struct test_suite *test __maybe_unused,static int test__bpf_pinning (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (1 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }
@@ -352,17 +352,17 @@ static int test__bpf_pinning(struct test_suite *test __maybe_unused,static int test__bpf_prologue_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (2 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif } static struct test_case bpf_tests[] = { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )TEST_CASE ("Basic BPF filtering" , basic_bpf_test),TEST_CASE_REASON ("BPF pinning" , bpf_pinning, "clang isn't installed or environment missing BPF support"),
@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = { TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif #else - TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"), - TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"), - TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), + TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"), #endif { .name = NULL, } };
Signature · 1 line
2.39.0
Em Tue, Jan 31, 2023 at 07:20:01PM +0530, Athira Rajeev escreveu:
Quoted 11 lines
"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.
Thanks, applied.
- Arnaldo
Quoted 101 lines
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 BPFThe 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(quoted diff) +0
-036: 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 Rajeev <[email protected]>--- tools/perf/tests/bpf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)tools/perf/tests/bpf.c +11
-11@@ -23,7 +23,7 @@#define NR_ITERS 111#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )#include <linux/bpf.h> #include <bpf/bpf.h> @@ -330,10 +330,10 @@ static int test__bpf(int i)static int test__basic_bpf_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (0 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -341,10 +341,10 @@ static int test__basic_bpf_test(struct test_suite *test __maybe_unused,static int test__bpf_pinning (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (1 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -352,17 +352,17 @@ static int test__bpf_pinning(struct test_suite *test __maybe_unused,static int test__bpf_prologue_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (2 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif } static struct test_case bpf_tests[] = { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )TEST_CASE ("Basic BPF filtering" , basic_bpf_test),TEST_CASE_REASON ("BPF pinning" , bpf_pinning, "clang isn't installed or environment missing BPF support"),@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = { TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif #else - TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"), - TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"), - TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), + TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"), #endif { .name = NULL, } };Signature · 1 line
2.39.0
Signature · 1 line
- Arnaldo
Quoted 14 lines · Arnaldo Carvalho de Melo
Em Tue, Jan 31, 2023 at 07:20:01PM +0530, Athira Rajeev escreveu:
Quoted 9 lines
"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!
Quoted 4 lines
Quoted 2 lines
The environment has clang but missing the libtraceevent devel. Hence perf is compiled without libtraceevent support.
Thanks, applied.
Hi,
Thanks for checking
Arnaldo, this is applied to tmp.perf/core branch ?
Athira
Quoted 109 lines
- Arnaldo
Quoted 101 lines
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 BPFThe 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 Rajeev <[email protected]>---
tools/perf/tests/bpf.c| 22 +++++++++++-----------1 file changed, 11 insertions(+), 11 deletions(-)tools/perf/tests/bpf.c +11
-11@@ -23,7 +23,7 @@#define NR_ITERS 111#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )#include <linux/bpf.h> #include <bpf/bpf.h> @@ -330,10 +330,10 @@ static int test__bpf(int i)static int test__basic_bpf_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (0 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -341,10 +341,10 @@ static int test__basic_bpf_test(struct test_suite *test __maybe_unused,static int test__bpf_pinning (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (1 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -352,17 +352,17 @@ static int test__bpf_pinning(struct test_suite *test __maybe_unused,static int test__bpf_prologue_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (2 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif } static struct test_case bpf_tests[] = { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )TEST_CASE ("Basic BPF filtering" , basic_bpf_test),TEST_CASE_REASON ("BPF pinning" , bpf_pinning, "clang isn't installed or environment missing BPF support"),@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = { TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif #else - TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"), - TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"), - TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), + TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"), #endif { .name = NULL, } };Signature · 1 line
2.39.0Signature · 1 line
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Mon, Feb 06, 2023 at 09:27:13AM +0530, Athira Rajeev escreveu:
Quoted 15 lines
Quoted 15 lines · Arnaldo Carvalho de Melo
Em Tue, Jan 31, 2023 at 07:20:01PM +0530, Athira Rajeev escreveu:
Quoted 11 lines
"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.
Quoted 7 lines
Quoted 1 line
Thanks, applied.
Hi,
Thanks for checking
Arnaldo, this is applied to tmp.perf/core branch ?
I thought I had this in :-\ Now its in tmp.perf/core.
- Arnaldo
Quoted 111 lines
Athira
Quoted 109 lines
- Arnaldo
Quoted 101 lines
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 BPFThe 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 Rajeev <[email protected]>---
tools/perf/tests/bpf.c| 22 +++++++++++-----------1 file changed, 11 insertions(+), 11 deletions(-)tools/perf/tests/bpf.c +11
-11@@ -23,7 +23,7 @@#define NR_ITERS 111#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )#include <linux/bpf.h> #include <bpf/bpf.h> @@ -330,10 +330,10 @@ static int test__bpf(int i)static int test__basic_bpf_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (0 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -341,10 +341,10 @@ static int test__basic_bpf_test(struct test_suite *test __maybe_unused,static int test__bpf_pinning (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (1 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -352,17 +352,17 @@ static int test__bpf_pinning(struct test_suite *test __maybe_unused,static int test__bpf_prologue_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (2 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif } static struct test_case bpf_tests[] = { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )TEST_CASE ("Basic BPF filtering" , basic_bpf_test),TEST_CASE_REASON ("BPF pinning" , bpf_pinning, "clang isn't installed or environment missing BPF support"),@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = { TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif #else - TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"), - TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"), - TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), + TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"), #endif { .name = NULL, } };Signature · 1 line
2.39.0Signature · 1 line
- Arnaldo
Signature · 1 line
- Arnaldo
Quoted 24 lines · Arnaldo Carvalho de Melo
Em Mon, Feb 06, 2023 at 09:27:13AM +0530, Athira Rajeev escreveu:
Quoted 19 lines
Quoted 12 lines · Arnaldo Carvalho de Melo
Em Tue, Jan 31, 2023 at 07:20:01PM +0530, Athira Rajeev escreveu:
Quoted 9 lines
"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!Quoted 4 lines
Quoted 2 lines
The environment has clang but missing the libtraceevent devel. Hence perf is compiled without libtraceevent support.
Thanks, applied.
Hi,
Quoted 7 lines
Quoted 3 lines
Thanks for checking
Arnaldo, this is applied to tmp.perf/core branch ?
I thought I had this in :-\ Now its in tmp.perf/core.
- Arnaldo
Hi Arnaldo,
Thanks for picking it.
Athira
Quoted 116 lines
Quoted 112 lines
Athira
Quoted 109 lines
- Arnaldo
Quoted 101 lines
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 BPFThe 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 Rajeev <[email protected]>---
tools/perf/tests/bpf.c| 22 +++++++++++-----------1 file changed, 11 insertions(+), 11 deletions(-)tools/perf/tests/bpf.c +11
-11@@ -23,7 +23,7 @@#define NR_ITERS 111#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )#include <linux/bpf.h> #include <bpf/bpf.h> @@ -330,10 +330,10 @@ static int test__bpf(int i)static int test__basic_bpf_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (0 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -341,10 +341,10 @@ static int test__basic_bpf_test(struct test_suite *test __maybe_unused,static int test__bpf_pinning (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (1 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -352,17 +352,17 @@ static int test__bpf_pinning(struct test_suite *test __maybe_unused,static int test__bpf_prologue_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (2 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif } static struct test_case bpf_tests[] = { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )TEST_CASE ("Basic BPF filtering" , basic_bpf_test),TEST_CASE_REASON ("BPF pinning" , bpf_pinning, "clang isn't installed or environment missing BPF support"),@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = { TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif #else - TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"), - TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"), - TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), + TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"), #endif { .name = NULL, } };Signature · 1 line
2.39.0Signature · 1 line
- ArnaldoSignature · 1 line
- Arnaldo
Quoted 26 lines · Athira Rajeev
"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 BPFThe 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,
Quoted 7 lines
# ./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 Rajeev<[email protected]>
Tested the patch on powerpc, perf bpf test skips when libtraceevent-devel package is not installed.
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)
Quoted 77 lines
--- tools/perf/tests/bpf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)tools/perf/tests/bpf.c +11
-11@@ -23,7 +23,7 @@#define NR_ITERS 111#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )#include <linux/bpf.h> #include <bpf/bpf.h> @@ -330,10 +330,10 @@ static int test__bpf(int i)static int test__basic_bpf_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (0 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -341,10 +341,10 @@ static int test__basic_bpf_test(struct test_suite *test __maybe_unused,static int test__bpf_pinning (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (1 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif }@@ -352,17 +352,17 @@ static int test__bpf_pinning(struct test_suite *test __maybe_unused,static int test__bpf_prologue_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) { -#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_BPF_PROLOGUE ) && defined(HAVE_LIBTRACEEVENT )return test__bpf (2 );#else -pr_debug ("Skip BPF test because BPF support is not compiled\n" ); +pr_debug ("Skip BPF test because BPF or libtraceevent support is not compiled\n" );return TEST_SKIP ;#endif } static struct test_case bpf_tests[] = { -#ifdef HAVE_LIBBPF_SUPPORT +#if defined(HAVE_LIBBPF_SUPPORT ) && defined(HAVE_LIBTRACEEVENT )TEST_CASE ("Basic BPF filtering" , basic_bpf_test),TEST_CASE_REASON ("BPF pinning" , bpf_pinning, "clang isn't installed or environment missing BPF support"),@@ -373,9 +373,9 @@ static struct test_case bpf_tests[] = { TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif #else - TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in"), - TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in"), - TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), + TEST_CASE_REASON("Basic BPF filtering", basic_bpf_test, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF pinning", bpf_pinning, "not compiled in or missing libtraceevent support"), + TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in or missing libtraceevent support"), #endif { .name = NULL, } };