tools/perf/tests: Skip perf BPF test if clang is not present
PATCH v2 1/1 tools/perf/tests: Skip perf BPF test if clang is not present
Perf BPF filter test fails in environment where "clang" is not installed.
Test failure logs:
<<>>
42: BPF filter : 42.1: Basic BPF filtering : Skip 42.2: BPF pinning : FAILED! 42.3: BPF prologue generation : FAILED!
<<>>
Enabling verbose option provided debug logs which says clang/llvm needs to be installed. Snippet of verbose logs:
<<>>
42.2: BPF pinning :
--- start ---
test child forked, pid 61423
ERROR: unable to find clang.
Hint: Try to install latest clang/llvm to support BPF.
Check your $PATH
<<logs_here>>
Failed to compile test case: 'Basic BPF llvm compile' Unable to get BPF object, fix kbuild first test child finished with -1
---- end ----
BPF filter subtest 2: FAILED!
<<>>
Here subtests, "BPF pinning" and "BPF prologue generation" failed and logs shows clang/llvm is needed. After installing clang, testcase passes.
Reason on why subtest failure happens though logs has proper debug information:
Main function __test__bpf calls test_llvm__fetch_bpf_obj by passing 4th argument as true ( 4th arguments maps to parameter "force" in test_llvm__fetch_bpf_obj ). But this will cause test_llvm__fetch_bpf_obj to skip the check for clang/llvm.
Snippet of code part which checks for clang based on parameter "force" in test_llvm__fetch_bpf_obj:
<<>>
if (!force && (!llvm_param.user_set_param &&
<<>>
Since force is set to "false", test won't get skipped and fails to compile test case. The BPF code compilation needs clang, So pass the fourth argument as "false" and also skip the test if reason for return is "TEST_SKIP"
After the patch:
<<>>
42: BPF filter : 42.1: Basic BPF filtering : Skip 42.2: BPF pinning : Skip 42.3: BPF prologue generation : Skip
<<>>
---
Changelog:
Addressed review comments from Arnaldo by adding reason for skipping of testcase.
tools/perf/tests/bpf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/perf/tests/bpf.c +6 -4
@@ -222,11 +222,11 @@ static int __test__bpf(int idx) ret =test_llvm__fetch_bpf_obj (&obj_buf, &obj_buf_sz, bpf_testcase_table[idx].prog_id, - true,NULL ); + false,NULL );if (ret !=TEST_OK || !obj_buf || !obj_buf_sz) {pr_debug ("Unable to get BPF object, %s\n" , bpf_testcase_table[idx].msg_compile_fail); -if (idx ==0 ) +if ((idx ==0 ) || (ret ==TEST_SKIP ))return TEST_SKIP ;else return TEST_FAIL ;
@@ -364,9 +364,11 @@ static int test__bpf_prologue_test(struct test_suite *test __maybe_unused, static struct test_case bpf_tests[] = {#ifdef HAVE_LIBBPF_SUPPORT TEST_CASE ("Basic BPF filtering" , basic_bpf_test), - TEST_CASE("BPF pinning", bpf_pinning), +TEST_CASE_REASON ("BPF pinning" , bpf_pinning, +"clang isn't installed or environment missing BPF support" ), #ifdef HAVE_BPF_PROLOGUE - TEST_CASE("BPF prologue generation", bpf_prologue_test), +TEST_CASE_REASON ("BPF prologue generation" , bpf_prologue_test, +"clang isn't installed or environment missing BPF support" ), #else TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif
Signature · 1 line
2.31.1
Quoted 66 lines · Athira Rajeev
Perf BPF filter test fails in environment where "clang" is not installed.
Test failure logs:
<<>>
42: BPF filter : 42.1: Basic BPF filtering : Skip 42.2: BPF pinning : FAILED! 42.3: BPF prologue generation : FAILED!<<>>
Enabling verbose option provided debug logs which says clang/llvm needs to be installed. Snippet of verbose logs:
<<>>
42.2: BPF pinning :
--- start ---
test child forked, pid 61423
ERROR: unable to find clang.
Hint: Try to install latest clang/llvm to support BPF.
Check your $PATH<<
logs_here>>Failed to compile test case: 'Basic BPF llvm compile' Unable to get BPF object, fix kbuild first test child finished with -1
---- end ----
BPF filter subtest 2: FAILED!
<<>>Here subtests, "BPF pinning" and "BPF prologue generation" failed and logs shows clang/llvm is needed. After installing clang, testcase passes.
Reason on why subtest failure happens though logs has proper debug information:
Main function__test__bpfcallstest_llvm__fetch_bpf_objby passing 4th argument as true ( 4th arguments maps to parameter "force" intest_llvm__fetch_bpf_obj). But this will causetest_llvm__fetch_bpf_objto skip the check for clang/llvm.Snippet of code part which checks for clang based on parameter "force" in
test_llvm__fetch_bpf_obj:<<>>
if (!force && (!llvm_param.user_set_param &&
<<>>Since force is set to "false", test won't get skipped and fails to compile test case. The BPF code compilation needs clang, So pass the fourth argument as "false" and also skip the test if reason for return is "
TEST_SKIP"After the patch:
<<>>
42: BPF filter : 42.1: Basic BPF filtering : Skip 42.2: BPF pinning : Skip 42.3: BPF prologue generation : Skip<<>>
Fixes ba1fae431e74 ("perf test: Add 'perf test BPF'")Signed-off-by Athira Rajeev <[email protected]>
Quoted 7 lines
---
Changelog:
Addressed review comments from Arnaldo by adding reason for skipping of testcase.tools/perf/tests/bpf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Patch looks fine to me.
Thanks,
Kajol Jain
Quoted 33 lines
tools/perf/tests/bpf.c +6
-4@@ -222,11 +222,11 @@ static int __test__bpf(int idx) ret =test_llvm__fetch_bpf_obj (&obj_buf, &obj_buf_sz, bpf_testcase_table[idx].prog_id, - true,NULL ); + false,NULL );if (ret !=TEST_OK || !obj_buf || !obj_buf_sz) {pr_debug ("Unable to get BPF object, %s\n" , bpf_testcase_table[idx].msg_compile_fail); -if (idx ==0 ) +if ((idx ==0 ) || (ret ==TEST_SKIP ))return TEST_SKIP ;else return TEST_FAIL ;@@ -364,9 +364,11 @@ static int test__bpf_prologue_test(struct test_suite *test __maybe_unused, static struct test_case bpf_tests[] = {#ifdef HAVE_LIBBPF_SUPPORT TEST_CASE ("Basic BPF filtering" , basic_bpf_test), - TEST_CASE("BPF pinning", bpf_pinning), +TEST_CASE_REASON ("BPF pinning" , bpf_pinning, +"clang isn't installed or environment missing BPF support" ), #ifdef HAVE_BPF_PROLOGUE - TEST_CASE("BPF prologue generation", bpf_prologue_test), +TEST_CASE_REASON ("BPF prologue generation" , bpf_prologue_test, +"clang isn't installed or environment missing BPF support" ), #else TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif
-----Original Message-----
From: Athira Rajeev <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] , [email protected]
Subject: [PATCH V2] tools/perf/tests: Skip perf BPF test if clang is not present
Date: Wed, 11 May 2022 17:24:38 +0530
Perf BPF filter test fails in environment where "clang"is not installed.
Test failure logs:
<<>> 42: BPF filter : 42.1: Basic BPF
filtering : Skip 42.2: BPF pinning : FAILED!
42.3: BPF prologue generation : FAILED!<<>>
Enabling verbose option provided debug logs which saysclang/llvm needs to be installed. Snippet of verbose logs:
<<>> 42.2: BPF pinning : --- start ---test child
forked, pid 61423ERROR: unable to find clang.Hint: Try to install
latest clang/llvm to support BPF. Check your $PATH
<<logs_here>>
Failed to compile test case: 'Basic BPF llvm compile'Unable to get BPF object, fix kbuild firsttest child finished with -1 ---- end ----BPF filter subtest 2: FAILED!<<>>
Here subtests, "BPF pinning" and "BPF prologue generation"failed and logs shows clang/llvm is needed. After installingclang, testcase passes.
Reason on why subtest failure happens though logs has properdebug information:Main function __test__bpf calls test_llvm__fetch_bpf_obj bypassing 4th argument as true ( 4th arguments maps to parameter"force" in test_llvm__fetch_bpf_obj ). But this will causetest_llvm__fetch_bpf_obj to skip the check for clang/llvm. Snippet of code part which checks for clang based onparameter "force" in test_llvm__fetch_bpf_obj:
<<>>if (!force && (!llvm_param.user_set_param &&<<>>
Since force is set to "false", test won't get skipped andfails to compile test case. The BPF code compilation needsclang, So pass the fourth argument as "false" and also skipthe test if reason for return is "TEST_SKIP"
After the patch:
<<>> 42: BPF filter : 42.1: Basic BPF
filtering : Skip 42.2: BPF pinning : Skip 42.3:
BPF prologue generation : Skip<<>>
Athira Rajeev <[email protected]>---Changelog: Addressed review comments from Arnaldo by adding reason for skipping of testcase.
tools/perf/tests/bpf.c | 10 ++++++---- 1 file changed, 6
insertions(+), 4 deletions(-)
Tested the patch on powerpc and powernv, perf BPF test works fine with the patch.Tested-by: Disha Goel <[email protected]>
tools/perf/tests/bpf.cindex renamed from tools/perf/tests/bpf.c +0 -0
57b9591f7cbb..17c023823713 100644--- a/tools/perf/tests/bpf.c+++ b/tools/perf/tests/bpf.c@@ -222,11 +222,11 @@ static int __test__bpf(int idx)
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
bpf_testcase_table[idx].prog_id,-
true, NULL);+
false, NULL); if (ret != TEST_OK || !obj_buf || !obj_buf_sz) {
pr_debug("Unable to get BPF object, %s\n",
bpf_testcase_table[idx].msg_compile_fail);- if (idx == 0)+
if ((idx == 0) || (ret == TEST_SKIP)) returnTEST_SKIP; else return TEST_FAIL;@@
-364,9 +364,11 @@ static int test__bpf_prologue_test(struct test_suite *test __maybe_unused, static struct test_case bpf_tests[] = { #ifdefHAVE_LIBBPF_SUPPORT TEST_CASE("Basic BPF filtering",
basic_bpf_test),- TEST_CASE("BPF pinning", bpf_pinning),+ TEST_CA
SE_REASON("BPF pinning", bpf_pinning,+ "clang isn't
installed or environment missing BPF support"), #ifdef
HAVE_BPF_PROLOGUE- TEST_CASE("BPF prologue generation",
bpf_prologue_test),+ TEST_CASE_REASON("BPF prologue generation",
bpf_prologue_test,+ "clang isn't installed or
environment missing BPF support"), #else TEST_CASE_REASON("BPF
prologue generation", bpf_prologue_test, "not compiled in"), #endif
Quoted 141 lines · Disha Goel
-----Original Message-----
From: Athira Rajeev <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: [PATCH V2]tools/perf/tests: Skip perf BPF test if clang is not present
Date: Wed, 11 May 2022 17:24:38 +0530Perf BPF filter test fails in environment where "clang"
is not installed.
Test failure logs:
<<>>
42: BPF filter :
42.1: Basic BPF filtering : Skip
42.2: BPF pinning : FAILED!
42.3: BPF prologue generation : FAILED!
<<>>
Enabling verbose option provided debug logs which says
clang/llvm needs to be installed. Snippet of verbose logs:
<<>>
42.2: BPF pinning :
--- start ---
test child forked, pid 61423
ERROR: unable to find clang.
Hint: Try to install latest clang/llvm to support BPF.
Check your $PATH
<<
logs_here>>Failed to compile test case: 'Basic BPF llvm compile'
Unable to get BPF object, fix kbuild first
test child finished with -1
---- end ----
BPF filter subtest 2: FAILED!
<<>>
Here subtests, "BPF pinning" and "BPF prologue generation"
failed and logs shows clang/llvm is needed. After installing
clang, testcase passes.
Reason on why subtest failure happens though logs has proper
debug information:
Main function
__test__bpfcallstest_llvm__fetch_bpf_objbypassing 4th argument as true ( 4th arguments maps to parameter
"force" in
test_llvm__fetch_bpf_obj). But this will cause
test_llvm__fetch_bpf_objto skip the check for clang/llvm.Snippet of code part which checks for clang based on
parameter "force" in
test_llvm__fetch_bpf_obj:<<>>
if (!force && (!llvm_param.user_set_param &&
<<>>
Since force is set to "false", test won't get skipped and
fails to compile test case. The BPF code compilation needs
clang, So pass the fourth argument as "false" and also skip
the test if reason for return is "
TEST_SKIP"After the patch:
<<>>
42: BPF filter :
42.1: Basic BPF filtering : Skip
42.2: BPF pinning : Skip
42.3: BPF prologue generation : Skip
<<>>
Fixes ba1fae431e74 ("perf test: Add 'perf test BPF'")Signed-off-by Athira Rajeev <Quoted 1 line
---
Changelog:
Addressed review comments from Arnaldo by adding
reason for skipping of testcase.
Quoted 8 lines
tools/perf/tests/bpf.c | 10 ++++++----1 file changed, 6 insertions(+), 4 deletions(-)Tested the patch on powerpc and powernv, perf BPF test works fine with the patch.
Tested-by Disha Goel <[email protected]>
Thanks!
Ian
Quoted 62 lines
tools/perf/tests/bpf.c +0
-0index
57b9591f7cbb..17c023823713100644---
a/tools/perf/tests/bpf.c+++
b/tools/perf/tests/bpf.ctools/perf/tests/bpf.c +1
-1@@ -222,11 +222,11 @@ static int __test__bpf(int idx) ret =test_llvm__fetch_bpf_obj (&obj_buf, &obj_buf_sz, bpf_testcase_table[idx].prog_id, - true,NULL ); + false,NULL );if (ret !=TEST_OK || !obj_buf || !obj_buf_sz) {pr_debug("Unable to get BPF object, %s\n",
bpf_testcase_table[idx].msg_compile_fail);- if (idx == 0)
+ if ((idx == 0) || (ret ==
TEST_SKIP))return
TEST_SKIP;else
return
TEST_FAIL;tools/perf/tests/bpf.c +4
-2@@ -364,9 +364,11 @@ static int test__bpf_prologue_test(struct test_suite *test __maybe_unused, static struct test_case bpf_tests[] = {#ifdef HAVE_LIBBPF_SUPPORT TEST_CASE ("Basic BPF filtering" , basic_bpf_test), - TEST_CASE("BPF pinning", bpf_pinning), +TEST_CASE_REASON ("BPF pinning" , bpf_pinning, +"clang isn't installed or environment missing BPF support" ), #ifdef HAVE_BPF_PROLOGUE - TEST_CASE("BPF prologue generation", bpf_prologue_test), +TEST_CASE_REASON ("BPF prologue generation" , bpf_prologue_test, +"clang isn't installed or environment missing BPF support" ), #else TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"), #endif
Quoted 151 lines · Ian Rogers
Quoted 146 lines · Disha Goel
-----Original Message-----
From: Athira Rajeev <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: [PATCH V2]tools/perf/tests: Skip perf BPF test if clang is not present
Date: Wed, 11 May 2022 17:24:38 +0530Perf BPF filter test fails in environment where "clang"
is not installed.
Test failure logs:
<<>>
42: BPF filter :
42.1: Basic BPF filtering : Skip
42.2: BPF pinning : FAILED!
42.3: BPF prologue generation : FAILED!
<<>>
Enabling verbose option provided debug logs which says
clang/llvm needs to be installed. Snippet of verbose logs:
<<>>
42.2: BPF pinning :
--- start ---
test child forked, pid 61423
ERROR: unable to find clang.
Hint: Try to install latest clang/llvm to support BPF.
Check your $PATH
<<
logs_here>>Failed to compile test case: 'Basic BPF llvm compile'
Unable to get BPF object, fix kbuild first
test child finished with -1
---- end ----
BPF filter subtest 2: FAILED!
<<>>
Here subtests, "BPF pinning" and "BPF prologue generation"
failed and logs shows clang/llvm is needed. After installing
clang, testcase passes.
Reason on why subtest failure happens though logs has proper
debug information:
Main function
__test__bpfcallstest_llvm__fetch_bpf_objbypassing 4th argument as true ( 4th arguments maps to parameter
"force" in
test_llvm__fetch_bpf_obj). But this will cause
test_llvm__fetch_bpf_objto skip the check for clang/llvm.Snippet of code part which checks for clang based on
parameter "force" in
test_llvm__fetch_bpf_obj:<<>>
if (!force && (!llvm_param.user_set_param &&
<<>>
Since force is set to "false", test won't get skipped and
fails to compile test case. The BPF code compilation needs
clang, So pass the fourth argument as "false" and also skip
the test if reason for return is "
TEST_SKIP"After the patch:
<<>>
42: BPF filter :
42.1: Basic BPF filtering : Skip
42.2: BPF pinning : Skip
42.3: BPF prologue generation : Skip
<<>>
Fixes ba1fae431e74 ("perf test: Add 'perf test BPF'")Signed-off-by Athira Rajeev <Quoted 1 line
---
Changelog:
Addressed review comments from Arnaldo by adding
reason for skipping of testcase.
tools/perf/tests/bpf.c| 10 ++++++----1 file changed, 6 insertions(+), 4 deletions(-)
Quoted 9 lines
Quoted 3 lines
Tested the patch on powerpc and powernv, perf BPF test works fine with the patch.
Tested-by Disha Goel <[email protected]>Acked-by Ian Rogers <[email protected]>Thanks!
Ian
Hi,
Thanks all for the review.
Athira
Quoted 62 lines
Quoted 62 lines
tools/perf/tests/bpf.c +0
-0index
57b9591f7cbb..17c023823713100644---
a/tools/perf/tests/bpf.c+++
b/tools/perf/tests/bpf.ctools/perf/tests/bpf.c +1
-1@@ -222,11 +222,11 @@ static int __test__bpf(int idx) ret =test_llvm__fetch_bpf_obj (&obj_buf, &obj_buf_sz, bpf_testcase_table[idx].prog_id, - true,NULL ); + false,NULL );if (ret !=TEST_OK || !obj_buf || !obj_buf_sz) {pr_debug("Unable to get BPF object, %s\n",
bpf_testcase_table[idx].msg_compile_fail);
- if (idx == 0)
+ if ((idx == 0) || (ret ==
TEST_SKIP))return
TEST_SKIP;else
return
TEST_FAIL;tools/perf/tests/bpf.c +2
-1@@ -364,9 +364,11 @@ static int test__bpf_prologue_test(struct test_suite *test __maybe_unused, static struct test_case bpf_tests[] = {#ifdef HAVE_LIBBPF_SUPPORT TEST_CASE ("Basic BPF filtering" , basic_bpf_test), - TEST_CASE("BPF pinning", bpf_pinning), +TEST_CASE_REASON ("BPF pinning" , bpf_pinning, + "clang isn't installed or environment missing BPF support"),#ifdef
HAVE_BPF_PROLOGUE-
TEST_CASE("BPF prologue generation", bpf_prologue_test),+ TEST_CASE_REASON("BPF prologue generation",
bpf_prologue_test,+ "clang isn't installed or environment missing BPF support"),
#else
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"),#endif