perf test bpf: Skip test if clang is not present

Perf BPF filter test fails in environment where "clang" is not

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


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

Reason on why subtest failure happens though logs has proper debug

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

After the patch:

 42: BPF filter                    :
 42.1: Basic BPF filtering         : Skip
 42.2: BPF pinning                 : Skip
 42.3: BPF prologue generation     : Skip

Fixes: ba1fae431e74bb42 ("perf test: Add 'perf test BPF'")
Reviewed-by: Kajol Jain <>
Signed-off-by: Athira Jajeev <>
Acked-by: Ian Rogers <>
Cc: Disha Goel <>
Cc: Jiri Olsa <>
Cc: Madhavan Srinivasan <>
Cc: Michael Ellerman <>
Cc: Nageswara R Sastry <>
Cc: Wang Nan <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed