diff options
author | Spoorthy S <[email protected]> | 2023-06-13 22:11:42 +0530 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2023-06-13 23:40:34 -0300 |
commit | c4a1a7763da3a7345f338e3666e3f7749b96b734 (patch) | |
tree | 669eda932c885159d17b94ccfef83a7ac08e517f | |
parent | 3b3bf0d112163524e61d1d6456c65e2157aade74 (diff) |
perf tests stat+shadow_stat.sh: Fix all POSIX sh warnings found using shellcheck
Running shellcheck -S on stat+shadow_stat.sh testcase, generates
SC2046 and SC2034 warnings,
$ shellcheck -S warning tests/shell/stat+shadow_stat.sh
res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)`
: Quote this to prevent word splitting
To address the POSIX shell warnings used quotes in the printf
expressions, to prevent word splitting.
Signed-off-by: Spoorthy S <[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: Arnaldo Carvalho de Melo <[email protected]>
-rwxr-xr-x | tools/perf/tests/shell/stat+shadow_stat.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/tests/shell/stat+shadow_stat.sh b/tools/perf/tests/shell/stat+shadow_stat.sh index e6e35fc6c882..0e9cba84e757 100755 --- a/tools/perf/tests/shell/stat+shadow_stat.sh +++ b/tools/perf/tests/shell/stat+shadow_stat.sh @@ -33,7 +33,7 @@ test_global_aggr() fi # use printf for rounding and a leading zero - res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)` + res=`printf "%.2f" "$(echo "scale=6; $num / $cyc" | bc -q)"` if [ "$ipc" != "$res" ]; then echo "IPC is different: $res != $ipc ($num / $cyc)" exit 1 @@ -67,7 +67,7 @@ test_no_aggr() fi # use printf for rounding and a leading zero - res=`printf "%.2f" $(echo "scale=6; $num / $cyc" | bc -q)` + res=`printf "%.2f" "$(echo "scale=6; $num / $cyc" | bc -q)"` if [ "$ipc" != "$res" ]; then echo "IPC is different for $cpu: $res != $ipc ($num / $cyc)" exit 1 |