[PATCH 07/17] perf/tests/shell : Shellcheck fixes for perf test "test_arm_coresight.sh"
Athira Rajeev
atrajeev at linux.vnet.ibm.com
Wed Jun 14 02:41:35 AEST 2023
From: Anushree Mathur <anushree.mathur at linux.vnet.ibm.com>
Fixed the following shellcheck issues in test_arm_coresight.sh file:
In tools/perf/tests/shell/test_arm_coresight.sh line 31:
trap - exit term int
^--^ SC2039: In POSIX sh, using lower/mixed case for signal names is undefined.
^--^ SC2039: In POSIX sh, using lower/mixed case for signal names is undefined.
^-^ SC2039: In POSIX sh, using lower/mixed case for signal names is undefined.
In tools/perf/tests/shell/test_arm_coresight.sh line 35:
trap cleanup_files exit term int
^--^ SC2039: In POSIX sh, using lower/mixed case for signal names is undefined.
^--^ SC2039: In POSIX sh, using lower/mixed case for signal names is undefined.
^-^ SC2039: In POSIX sh, using lower/mixed case for signal names is undefined.
In tools/perf/tests/shell/test_arm_coresight.sh line 92:
if [ $? -eq 0 -a -e "$1/enable_sink" ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Fixed above warnings by:
1)Capitalize signals(INT, TERM, EXIT) to avoid mixed/lower case naming of
signals.
2)Expression [p -a q] was not defined,changed it to [p] && [q] to avoid the
ambiguity as this is older format using -a or -o ,now we use [p] && [q] in
place of [p -a q] and [p] || [q] in place of [p -o q].
Result after fixing the issues:
shell$ shellcheck -S warning test_arm_coresight.sh
shell$
Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain at linux.ibm.com>
Signed-off-by: Anushree Mathur <anushree.mathur at linux.vnet.ibm.com>
---
tools/perf/tests/shell/test_arm_coresight.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
index 482009e17bda..f1bf5621160f 100755
--- a/tools/perf/tests/shell/test_arm_coresight.sh
+++ b/tools/perf/tests/shell/test_arm_coresight.sh
@@ -28,11 +28,11 @@ cleanup_files()
rm -f ${perfdata}
rm -f ${file}
rm -f "${perfdata}.old"
- trap - exit term int
+ trap - EXIT TERM INT
exit $glb_err
}
-trap cleanup_files exit term int
+trap cleanup_files EXIT TERM INT
record_touch_file() {
echo "Recording trace (only user mode) with path: CPU$2 => $1"
@@ -89,7 +89,7 @@ is_device_sink() {
# cannot support perf PMU.
echo "$1" | grep -E -q -v "tpiu"
- if [ $? -eq 0 -a -e "$1/enable_sink" ]; then
+ if [ $? -eq 0 ] && [ -e "$1/enable_sink" ]; then
pmu_dev="/sys/bus/event_source/devices/cs_etm/sinks/$2"
--
2.39.1
More information about the Linuxppc-dev
mailing list