diff options
author | Disha Goel <[email protected]> | 2023-06-13 22:11:30 +0530 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2023-06-13 23:40:33 -0300 |
commit | b3839ff1f40eba632177bc4775a35ed65a2262a6 (patch) | |
tree | bced37bf0400548ec348a1b44922c42f19eb2328 | |
parent | 75782e825377bd2745c0231a0f3483888514acb6 (diff) |
perf tests stat+json_output: Address shellcheck warnings
Running shellcheck on stat+json_output testcase, generates below warning:
[ $(id -u) != 0 ] && [ $(cat /proc/sys/kernel/perf_event_paranoid) -gt $1 ]
^------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2046 (warning): Quote this to prevent word splitting.
Fixed the warning by adding quotes to avoid word splitting.
ShellCheck result with patch:
# shellcheck -S warning stat+json_output.sh
#
perf test result after the change:
94: perf stat JSON output linter : Ok
Signed-off-by: Disha Goel <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Kajol Jain <[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/linux-perf-users/[email protected]
Signed-off-by: Athira Rajeev <[email protected]>
Signed-off-by: Kajol Jain <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rwxr-xr-x | tools/perf/tests/shell/stat+json_output.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/tests/shell/stat+json_output.sh b/tools/perf/tests/shell/stat+json_output.sh index c282afa6217c..196e22672c50 100755 --- a/tools/perf/tests/shell/stat+json_output.sh +++ b/tools/perf/tests/shell/stat+json_output.sh @@ -40,7 +40,7 @@ trap trap_cleanup EXIT TERM INT # 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() |