[PATCH v2 01/12] perf tests record: Cleanup improvements
From: Ian Rogers
Date: Thu Apr 10 2025 - 13:37:36 EST
Remove the script output file. Add a trap debug message. Minor style
consistency changes.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/tests/shell/record.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index ba8d873d3ca7..05d91a663fda 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -34,13 +34,15 @@ default_fd_limit=$(ulimit -Sn)
min_fd_limit=$(($(getconf _NPROCESSORS_ONLN) * 16))
cleanup() {
- rm -rf "${perfdata}"
- rm -rf "${perfdata}".old
+ rm -f "${perfdata}"
+ rm -f "${perfdata}".old
+ rm -f "${script_output}"
trap - EXIT TERM INT
}
trap_cleanup() {
+ echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
@@ -239,7 +241,7 @@ test_leader_sampling() {
return
fi
index=0
- perf script -i "${perfdata}" > $script_output
+ perf script -i "${perfdata}" > "${script_output}"
while IFS= read -r line
do
# Check if the two instruction counts are equal in each record
@@ -252,7 +254,7 @@ test_leader_sampling() {
fi
index=$(($index+1))
prev_cycles=$cycles
- done < $script_output
+ done < "${script_output}"
echo "Basic leader sampling test [Success]"
}
--
2.49.0.604.gff1f9ca942-goog