Re: [PATCH 1/3] perf test: fix nanosleep check in the ftrace test

From: Namhyung Kim

Date: Mon Apr 27 2026 - 18:29:58 EST


On Mon, Apr 27, 2026 at 11:01:41AM +0200, Martin Kaiser wrote:
> The perf ftrace test case runs
>
> perf ftrace profile --graph-opts depth=5 sleep 0.1
>
> and checks that the output contains a *clock_nanosleep function with a
> count of 1.
>
> This fails on a risc-v system that uses musl as its C library. musl's
> nanosleep syscall wrapper uses either the nanosleep or the
> clock_nanosleep syscall.
>
> Filter for sys_*nanosleep to allow both syscalls.
>
> Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>

Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Thanks,
Namhyung

> ---
> tools/perf/tests/shell/ftrace.sh | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/tests/shell/ftrace.sh b/tools/perf/tests/shell/ftrace.sh
> index 7f8aafcbb761..9f6e590f6437 100755
> --- a/tools/perf/tests/shell/ftrace.sh
> +++ b/tools/perf/tests/shell/ftrace.sh
> @@ -71,9 +71,10 @@ test_ftrace_profile() {
> grep ^# "${output}"
> time_re="[[:space:]]+1[[:digit:]]{5}\.[[:digit:]]{3}"
> # 100283.000 100283.000 100283.000 1 __x64_sys_clock_nanosleep
> - # Check for one *clock_nanosleep line with a Count of just 1 that takes a bit more than 0.1 seconds
> - # Strip the _x64_sys part to work with other architectures
> - grep -E "^${time_re}${time_re}${time_re}[[:space:]]+1[[:space:]]+.*clock_nanosleep" "${output}"
> + # Check for one *sys_*nanosleep line with a Count of just 1 that takes a bit more than 0.1 seconds
> + # Strip the _x64_ part to work with other architectures, strip the clock part to support
> + # C libraries that use the nanosleep syscall instead of clock_nanosleep
> + grep -E "^${time_re}${time_re}${time_re}[[:space:]]+1[[:space:]]+.*sys_.*nanosleep" "${output}"
> echo "perf ftrace profile test [Success]"
> }
>
> --
> 2.43.7
>