Commit 19af23df authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf test: test_intel_pt.sh: Add cleanup function

Add a cleanup function that will still clean up if the script is
terminated prematurely.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220912083412.7058-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4627a000
......@@ -14,6 +14,21 @@ err_cnt=0
tmpfile=`mktemp`
perfdatafile=`mktemp`
cleanup()
{
trap - EXIT TERM INT
rm -f ${tmpfile}
rm -f ${perfdatafile}
}
trap_cleanup()
{
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
can_cpu_wide()
{
perf record -o ${tmpfile} -B -N --no-bpf-event -e dummy:u -C $1 true 2>&1 >/dev/null || return 2
......@@ -57,8 +72,7 @@ test_system_wide_side_band
count_result $?
rm -f ${tmpfile}
rm -f ${perfdatafile}
cleanup
if [ ${err_cnt} -gt 0 ] ; then
exit 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment