Commit 170ac70f authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf test: test_intel_pt.sh: Use a temp directory

Create a directory for temporary files so that mktemp needs to be used
only once. It also enables more temp files to be added without having to
add them also to the cleanup.
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-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 19af23df
......@@ -11,14 +11,20 @@ skip_cnt=0
ok_cnt=0
err_cnt=0
tmpfile=`mktemp`
perfdatafile=`mktemp`
temp_dir=$(mktemp -d /tmp/perf-test-intel-pt-sh.XXXXXXXXXX)
tmpfile="${temp_dir}/tmp-perf.data"
perfdatafile="${temp_dir}/test-perf.data"
cleanup()
{
trap - EXIT TERM INT
rm -f ${tmpfile}
rm -f ${perfdatafile}
sane=$(echo "${temp_dir}" | cut -b 1-26)
if [ "${sane}" = "/tmp/perf-test-intel-pt-sh" ] ; then
echo "--- Cleaning up ---"
rm -f "${temp_dir}/"*
rmdir "${temp_dir}"
fi
}
trap_cleanup()
......
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