perf tests: Improve temp file cleanup in test_arm_coresight.sh
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. Reviewed-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20210921131009.390810-3-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
39c534889e
commit
133fe2e617
1 changed files with 8 additions and 3 deletions
|
@ -9,8 +9,6 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
# Leo Yan <leo.yan@linaro.org>, 2020
|
# Leo Yan <leo.yan@linaro.org>, 2020
|
||||||
|
|
||||||
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
|
|
||||||
file=$(mktemp /tmp/temporary_file.XXXXX)
|
|
||||||
glb_err=0
|
glb_err=0
|
||||||
|
|
||||||
skip_if_no_cs_etm_event() {
|
skip_if_no_cs_etm_event() {
|
||||||
|
@ -22,13 +20,20 @@ skip_if_no_cs_etm_event() {
|
||||||
|
|
||||||
skip_if_no_cs_etm_event || exit 2
|
skip_if_no_cs_etm_event || exit 2
|
||||||
|
|
||||||
|
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
|
||||||
|
file=$(mktemp /tmp/temporary_file.XXXXX)
|
||||||
|
|
||||||
cleanup_files()
|
cleanup_files()
|
||||||
{
|
{
|
||||||
rm -f ${perfdata}
|
rm -f ${perfdata}
|
||||||
rm -f ${file}
|
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() {
|
record_touch_file() {
|
||||||
echo "Recording trace (only user mode) with path: CPU$2 => $1"
|
echo "Recording trace (only user mode) with path: CPU$2 => $1"
|
||||||
|
|
Loading…
Add table
Reference in a new issue