perf tests lock_contention: Fix shellcheck issue about quoting to avoid word splitting
authorKajol Jain <kjain@linux.ibm.com>
Sun, 9 Jul 2023 18:27:38 +0000 (23:57 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 3 Aug 2023 20:01:25 +0000 (17:01 -0300)
commitedf197cb9da529ef854ba21311ddbaddc7098eba
treee65dd10de434d42b55fd71526596b4c83d1510ec
parenta225c3049791b1591debf07fa9f4377b2c331ecc
perf tests lock_contention: Fix shellcheck issue about quoting to avoid word splitting

Running shellcheck on lock_contention.sh generates below warning:

In tests/shell/lock_contention.sh line 24:
if [ `id -u` != 0 ]; then
             ^-----^ SC2046 (warning): Quote this to prevent word splitting.

In tests/shell/lock_contention.sh line 160:
local type=$(head -1 "${result}" | awk '{ print $8 }' | sed -e 's/:.*//')
        ^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
              ^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                   ^-- SC2046 (warning): Quote this to prevent word splitting.

Fixed above warnings by:

- Adding quotes to avoid word splitting.
- Fixing shellcheck warnings for local usage, by prefixing
  function name to the variable.

Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230709182800.53002-5-atrajeev@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/shell/lock_contention.sh