diff options
author | Anushree Mathur <anushree.mathur@linux.vnet.ibm.com> | 2023-06-13 22:11:35 +0530 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-06-13 23:40:33 -0300 |
commit | 0ed4b531e7da1193fa10786672f28d7734eb06ec (patch) | |
tree | 463364acbeb0596a3ae6c7b218588beae92a6842 /tools/perf/tests | |
parent | 9e9d07a71fa44ead54eda05754d17aa02f18b5b2 (diff) |
perf tests test_arm_coresight: Shellcheck fixes
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: Anushree Mathur <anushree.mathur@linux.vnet.ibm.com>
Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230613164145.50488-8-atrajeev@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
-rwxr-xr-x | tools/perf/tests/shell/test_arm_coresight.sh | 6 |
1 files 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" |