linux/tools/perf/tests/shell/lib
Ian Rogers 509a2b9a6e perf tests: Fix flakiness in trace record and replay test
The `perf trace record and replay` test fails intermittently on slow or
virtualized hosts because the default recording workload (`sleep 1`)
occasionally completes without scheduling the target `nanosleep` or
`clock_nanosleep` system calls inside the recorded sample window,
resulting in the error: `Failed: cannot find *nanosleep syscall`.

Generalize the `perf_record_with_retry` helper in
`tests/shell/lib/perf_record.sh` to support a custom record command prefix
via the `PERF_RECORD_CMD` environment variable (defaulting to "perf
record").

Update `trace_record_replay.sh` to use this robust retry loop running with
`PERF_RECORD_CMD="perf trace record"` and a base workload of `sleep`. The
test will automatically retry with scaled sleep durations (from 0.01s up
to 2.0s) until the required `nanosleep` event is successfully captured.

Fixes: 15bcfb96d0 ("perf test: Add trace record and replay test")
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-06-30 17:09:13 -07:00
..
attr.py perf test: Address attr.py mypy error 2025-03-24 09:38:20 -07:00
perf_has_symbol.sh perf test: Change all remaining #!/bin/sh to #!/bin/bash 2025-06-26 10:31:05 -07:00
perf_json_output_lint.py perf test: Be tolerant of missing json metric none value 2025-11-16 23:24:00 -08:00
perf_metric_validation_rules.json perf test: Add skip list for metrics known would fail 2023-06-21 22:23:57 -07:00
perf_metric_validation.py perf tests: Skip metrics validation if system-wide recording lacks permission 2026-06-30 17:09:13 -07:00
perf_record.sh perf tests: Fix flakiness in trace record and replay test 2026-06-30 17:09:13 -07:00
probe_vfs_getname.sh perf test: Change all remaining #!/bin/sh to #!/bin/bash 2025-06-26 10:31:05 -07:00
probe.sh perf tests lib probe: Fix shellcheck warning about about missing shebang 2023-08-03 17:01:26 -03:00
setup_python.sh perf python: Add LiveSession helper 2026-06-30 10:17:19 -07:00
stat_output.sh perf test stat csv: Update test expectations and events 2025-11-11 16:48:36 -08:00
waiting.sh perf test: Change all remaining #!/bin/sh to #!/bin/bash 2025-06-26 10:31:05 -07:00