Re: [PATCH 1/3] perf test: Fix errors when deleting data in perf record tests

From: Arnaldo Carvalho de Melo

Date: Fri Sep 25 2026 - 06:55:26 EST


On Wed, Sep 23, 2026 at 02:52:53PM -0700, Namhyung Kim wrote:
> perf record with multithreads would create a data directory instead of a
> file. But the cleanup and retry logic expect a file and try to delete
> them with 'rm -f' which would fail. Add '-r' flag to remove directories.
>
> rm: cannot remove '/tmp/__perf_test.perf.data.ZVHTw.old': Is a directory


Thanks, applied the series to perf-tools-next, for v7.4.

- Arnaldo

> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> tools/perf/tests/shell/lib/perf_record.sh | 2 +-
> tools/perf/tests/shell/record.sh | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/tests/shell/lib/perf_record.sh b/tools/perf/tests/shell/lib/perf_record.sh
> index 2b9e11b66dc7a801..a95fafb8b6fa8b40 100644
> --- a/tools/perf/tests/shell/lib/perf_record.sh
> +++ b/tools/perf/tests/shell/lib/perf_record.sh
> @@ -30,7 +30,7 @@ perf_record_with_retry() {
> fi
>
> for duration in 0.01 0.1 0.3 1.0 2.0; do
> - rm -f "${perfdata}".old
> + rm -rf "${perfdata}".old
> ${cmd_prefix} "$@" -o "${perfdata}" ${testprog_base} ${duration} > "$logfile" 2>&1
> local record_exit=$?
>
> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
> index 4a4931cb5ba91849..cf8ba3d3411b0bcc 100755
> --- a/tools/perf/tests/shell/record.sh
> +++ b/tools/perf/tests/shell/record.sh
> @@ -39,8 +39,8 @@ default_fd_limit=$(ulimit -Sn)
> min_fd_limit=$(($(getconf _NPROCESSORS_ONLN) * 16))
>
> cleanup() {
> - rm -f "${perfdata}"
> - rm -f "${perfdata}".old
> + rm -rf "${perfdata}"
> + rm -rf "${perfdata}".old
> rm -f "${script_output}"
> perf_record_cleanup
>
> --
> 2.56.0.rc1.310.g51773c2048-goog