mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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 <[email protected]> Signed-off-by: James Clark <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
1 parent
39c534889e
commit
133fe2e617
1 file changed
+8
-3
@@ -9,8 +9,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Leo Yan <[email protected]>, 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"
|
||||
|
||||
Reference in new issue
Block a user