Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tests/shell: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase

Running shellcheck on stat+shadow_stat.sh generates below
warning

In tests/shell/stat+csv_summary.sh line 26:
while read _num _event _run _pct
^--^ SC2034: _num appears unused. Verify use (or export if used externally).
^----^ SC2034: _event appears unused. Verify use (or export if used externally).
^--^ SC2034: _run appears unused. Verify use (or export if used externally).
^--^ SC2034: _pct appears unused. Verify use (or export if used externally).

This variable is intentionally unused since it is
needed to parse through the output. commit used "_"
as a prefix for this throw away variable. But this
stil shows warning with shellcheck v0.6. Fix this
by only using "_" instead of prefix and variable name.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230907171540.36736-3-atrajeev@linux.vnet.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Athira Rajeev and committed by
Namhyung Kim
55312ca7 35de80c7

+4 -4
+2 -2
tools/perf/tests/shell/stat+csv_summary.sh
··· 10 10 # 11 11 perf stat -e cycles -x' ' -I1000 --interval-count 1 --summary 2>&1 | \ 12 12 grep -e summary | \ 13 - while read summary _num _event _run _pct 13 + while read summary _ _ _ _ 14 14 do 15 15 if [ $summary != "summary" ]; then 16 16 exit 1 ··· 23 23 # 24 24 perf stat -e cycles -x' ' -I1000 --interval-count 1 --summary --no-csv-summary 2>&1 | \ 25 25 grep -e summary | \ 26 - while read _num _event _run _pct 26 + while read _ _ _ _ 27 27 do 28 28 exit 1 29 29 done
+2 -2
tools/perf/tests/shell/stat+shadow_stat.sh
··· 16 16 { 17 17 perf stat -a --no-big-num -e cycles,instructions sleep 1 2>&1 | \ 18 18 grep -e cycles -e instructions | \ 19 - while read num evt _hash ipc rest 19 + while read num evt _ ipc rest 20 20 do 21 21 # skip not counted events 22 22 if [ "$num" = "<not" ]; then ··· 55 55 { 56 56 perf stat -a -A --no-big-num -e cycles,instructions sleep 1 2>&1 | \ 57 57 grep ^CPU | \ 58 - while read cpu num evt _hash ipc rest 58 + while read cpu num evt _ ipc rest 59 59 do 60 60 # skip not counted events 61 61 if [ "$num" = "<not" ]; then