perf test: Skip syscall enum test if no landlock syscall
Namhyung Kim
maintainerPATCH 1/1 perf test: Skip syscall enum test if no landlock syscall
The perf trace enum augmentation test specifically targets landlock_ add_rule syscall but IIUC it's an optional and can be opt-out by a kernel config.
Currently trace_landlock() runs perf test -w landlock before the actual testing to check the availability but it's not enough since the workload always returns 0. Instead it could check if perf trace output has 'landlock' string.
--- tools/perf/tests/shell/trace_btf_enum.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/tests/shell/trace_btf_enum.sh +5 -1
@@ -27,7 +27,11 @@ trace_landlock() { echo "Tracing syscall ${syscall}" # test flight just to see if landlock_add_rule and libbpf are available - $TESTPROG + if ! perf trace $TESTPROG 2>&1 | grep -q landlock + then + echo "No landlock system call found. Fallback to non-syscall tracing." + return + fi if perf trace -e $syscall $TESTPROG 2>&1 | \ grep -q -E ".*landlock_add_rule\(ruleset_fd: 11, rule_type: (LANDLOCK_RULE_PATH_BENEATH|LANDLOCK_RULE_NET_PORT), rule_attr: 0x[a-f0-9]+, flags: 45\) = -1.*"
Signature · 1 line
2.48.0.rc2.279.g1de40edade-goog
Hello Namhyung,
Quoted 9 lines · Namhyung Kim
The perf trace enum augmentation test specifically targets
landlock_add_rulesyscall but IIUC it's an optional and can be opt-out by a kernel config.Currently
trace_landlock()runsperf test -w landlockbefore the actual testing to check the availability but it's not enough since the workload always returns 0. Instead it could check if perf trace output has 'landlock' string.
I remember doing the landlock syscall nr ifdef checking and returning -1... Somehow it's not there... Sorry.
Quoted 13 lines
Fixes d66763fed30f0bd8c ("perf test trace_btf_enum: Add regression test for the BTF augmentation of enums in 'perf trace'")Cc Howard Chu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/tests/shell/trace_btf_enum.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/tests/shell/trace_btf_enum.sh +0
-0
tools/perf/tests/shell/trace_btf_enum.sh trace_landlock() { · line 29
Quoted 3 lines
tools/perf/tests/shell/trace_btf_enum.sh +0
-0@@ -27,7 +27,11 @@ trace_landlock() { echo "Tracing syscall ${syscall}" # test flight just to see if landlock_add_rule and libbpf are available
Wonder why I put 'libbpf' here, can you please change this comment to '# test flight just to see if landlock_add_rule is available' If you find this change appropriate?
tools/perf/tests/shell/trace_btf_enum.sh trace_landlock() { · line 32
Quoted 4 lines
tools/perf/tests/shell/trace_btf_enum.sh +3
-1- $TESTPROG + if ! perf trace $TESTPROG 2>&1 | grep -q landlock + then + echo "No landlock system call found. Fallback to non-syscall tracing."
I wouldn't say it's a fallback, because the non-syscall test gets run even if the landlock_add_rule syscall can be invoked. Why not say: 'No landlock system call found, skipping to non-syscall tracing'?
Quoted 8 lines
tools/perf/tests/shell/trace_btf_enum.sh +2
-1+ return + fi if perf trace -e $syscall $TESTPROG 2>&1 | \ grep -q -E ".*landlock_add_rule\(ruleset_fd: 11, rule_type: (LANDLOCK_RULE_PATH_BENEATH|LANDLOCK_RULE_NET_PORT), rule_attr: 0x[a-f0-9]+, flags: 45\) = -1.*" --2.48.0.rc2.279.g1de40edade-goog
Other things LGTM.
Thanks,
Howard
Namhyung Kim
maintainerQuoted 8 lines · Howard Chu
Hello Namhyung,
Quoted 5 lines · Namhyung Kim
The perf trace enum augmentation test specifically targets
landlock_add_rulesyscall but IIUC it's an optional and can be opt-out by a kernel config.
Quoted 7 lines
Quoted 4 lines
Currently
trace_landlock()runsperf test -w landlockbefore the actual testing to check the availability but it's not enough since the workload always returns 0. Instead it could check if perf trace output has 'landlock' string.I remember doing the landlock syscall nr ifdef checking and returning -1... Somehow it's not there... Sorry.
That's ok, we can fix it later. :)
Quoted 16 lines
Quoted 16 lines
Fixes d66763fed30f0bd8c ("perf test trace_btf_enum: Add regression test for the BTF augmentation of enums in 'perf trace'")Cc Howard Chu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/tests/shell/trace_btf_enum.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/tests/shell/trace_btf_enum.sh +0
-0@@ -27,7 +27,11 @@ trace_landlock() { echo "Tracing syscall ${syscall}"
Quoted 5 lines
tools/perf/tests/shell/trace_btf_enum.sh trace_landlock() { · line 29
Quoted 1 line
tools/perf/tests/shell/trace_btf_enum.sh +0
-0# test flight just to see if landlock_add_rule and libbpf are availableWonder why I put 'libbpf' here, can you please change this comment to '# test flight just to see if
landlock_add_ruleis available' If you find this change appropriate?
Sure, will update.
Quoted 9 lines
tools/perf/tests/shell/trace_btf_enum.sh trace_landlock() { · line 32
Quoted 5 lines
tools/perf/tests/shell/trace_btf_enum.sh +3
-1- $TESTPROG + if ! perf trace $TESTPROG 2>&1 | grep -q landlock + then + echo "No landlock system call found. Fallback to non-syscall tracing."I wouldn't say it's a fallback, because the non-syscall test gets run even if the
landlock_add_rulesyscall can be invoked. Why not say: 'No landlock system call found, skipping to non-syscall tracing'?
Ok.
Quoted 10 lines
Quoted 9 lines
tools/perf/tests/shell/trace_btf_enum.sh +2
-1+ return + fi if perf trace -e $syscall $TESTPROG 2>&1 | \ grep -q -E ".*landlock_add_rule\(ruleset_fd: 11, rule_type: (LANDLOCK_RULE_PATH_BENEATH|LANDLOCK_RULE_NET_PORT), rule_attr: 0x[a-f0-9]+, flags: 45\) = -1.*" --2.48.0.rc2.279.g1de40edade-goog
Quoted 3 lines
Other things LGTM.
Reviewed-by Howard Chu <[email protected]>
Thanks for your review!
Namhyung