[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fVF+LVFFHiBYfCesRmPiy7n2qZyTpMoH1eizQYMG9dPCw@mail.gmail.com>
Date: Tue, 21 Sep 2021 23:10:10 -0700
From: Ian Rogers <irogers@...gle.com>
To: James Clark <james.clark@....com>
Cc: acme@...nel.org, leo.yan@...aro.com,
linux-perf-users@...r.kernel.org,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] perf tests: Improve temp file cleanup in test_arm_coresight.sh
On Tue, Sep 21, 2021 at 6:10 AM James Clark <james.clark@....com> wrote:
>
> Cleanup perf.data.old files which are also dropped by perf, handle
> sigint and propagate it to the parent in case the test is run in a bash
> while loop and don't create the temp files if the test will be skipped.
>
> Signed-off-by: James Clark <james.clark@....com>
Acked-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
>
> ---
> tools/perf/tests/shell/test_arm_coresight.sh | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
> index c9eef0bba6f1..6de53b7ef5ff 100755
> --- a/tools/perf/tests/shell/test_arm_coresight.sh
> +++ b/tools/perf/tests/shell/test_arm_coresight.sh
> @@ -9,8 +9,6 @@
> # SPDX-License-Identifier: GPL-2.0
> # Leo Yan <leo.yan@...aro.org>, 2020
>
> -perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> -file=$(mktemp /tmp/temporary_file.XXXXX)
> glb_err=0
>
> skip_if_no_cs_etm_event() {
> @@ -22,13 +20,20 @@ skip_if_no_cs_etm_event() {
>
> skip_if_no_cs_etm_event || exit 2
>
> +perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> +file=$(mktemp /tmp/temporary_file.XXXXX)
> +
> cleanup_files()
> {
> rm -f ${perfdata}
> rm -f ${file}
> + rm -f "${perfdata}.old"
> + trap - exit term int
> + kill -2 $$
> + exit $glb_err
> }
>
> -trap cleanup_files exit
> +trap cleanup_files exit term int
>
> record_touch_file() {
> echo "Recording trace (only user mode) with path: CPU$2 => $1"
> --
> 2.28.0
>
Powered by blists - more mailing lists