aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKorrapati Likhitha <[email protected]>2023-06-13 22:11:33 +0530
committerArnaldo Carvalho de Melo <[email protected]>2023-06-13 23:40:33 -0300
commit9e9d07a71fa44ead54eda05754d17aa02f18b5b2 (patch)
tree374e9dd671ba069d561324592856af251df4828a
parent5bd35dfb48b0af870093f2ee130883228b49352a (diff)
perf tests stat+csv_output: Fix shellcheck warnings
Running the shellcheck on stat+csv_output resulted in the following warning. Result with shellcheck without patch: ===== $ shellcheck -S warning stat+csv_output.sh In stat+csv_output.sh line 23: [ $(uname -m) = "s390x" ] && exp='^[6-7]$' ^---------^ SC2046: Quote this to prevent word splitting. In stat+csv_output.sh line 51: [ $(id -u) != 0 ] && [ $(cat /proc/sys/kernel/perf_event_paranoid) -gt $1 ] ^------^ SC2046: Quote this to prevent word splitting. ^-- SC2046: Quote this to prevent word splitting. ===== Fixed the warning SC2046 by adding quotes to prevent word splitting. Result with shellcheck with patch: ===== $ shellcheck -S warning tests/shell/stat+csv_output.sh $ ./perf test "stat CSV output linter" 96: perf stat CSV output linter : Ok ===== Signed-off-by: Korrapati Likhitha <[email protected]> Cc: Disha Goel <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Athira Rajeev <[email protected]> Signed-off-by: Kajol Jain <[email protected]> Signed-off-by: Sathvika Vasireddy <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rwxr-xr-xtools/perf/tests/shell/stat+csv_output.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/tests/shell/stat+csv_output.sh b/tools/perf/tests/shell/stat+csv_output.sh
index a1969f236a0a..ed082daf839c 100755
--- a/tools/perf/tests/shell/stat+csv_output.sh
+++ b/tools/perf/tests/shell/stat+csv_output.sh
@@ -35,7 +35,7 @@ function commachecker()
;; "--interval") exp=7
;; "--per-thread") exp=7
;; "--system-wide-no-aggr") exp=7
- [ $(uname -m) = "s390x" ] && exp='^[6-7]$'
+ [ "$(uname -m)" = "s390x" ] && exp='^[6-7]$'
;; "--per-core") exp=8
;; "--per-socket") exp=8
;; "--per-node") exp=8
@@ -66,7 +66,7 @@ function commachecker()
# Return true if perf_event_paranoid is > $1 and not running as root.
function ParanoidAndNotRoot()
{
- [ $(id -u) != 0 ] && [ $(cat /proc/sys/kernel/perf_event_paranoid) -gt $1 ]
+ [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
}
check_no_args()