From: Ian Rogers Date: Thu, 10 Apr 2025 17:36:20 +0000 (-0700) Subject: perf tests record: Cleanup improvements X-Git-Tag: v6.16-rc1~57^2~129 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be8aefad33760dd8bc0499988f4e4f3e779851d0;p=thirdparty%2Flinux.git perf tests record: Cleanup improvements Remove the script output file. Add a trap debug message. Minor style consistency changes. Signed-off-by: Ian Rogers Link: https://lore.kernel.org/r/20250410173631.1713627-2-irogers@google.com Cc: Mark Rutland Cc: Levi Yun Cc: Dominique Martinet Cc: Howard Chu Cc: Tengda Wu Cc: Peter Zijlstra Cc: Adrian Hunter Cc: Weilin Wang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Namhyung Kim Cc: Hao Ge Cc: James Clark Cc: Thomas Richter Cc: Alexander Shishkin Cc: Dapeng Mi Cc: Kan Liang Cc: Xu Yang Cc: Ingo Molnar Cc: Veronika Molnarova Cc: Dr. David Alan Gilbert Cc: bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index ba8d873d3ca73..05d91a663fda9 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]" }