tests/shell: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Thu, 7 Sep 2023 17:15:39 +0000 (22:45 +0530)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 27 Sep 2023 04:47:12 +0000 (21:47 -0700)
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>
tools/perf/tests/shell/stat+csv_summary.sh
tools/perf/tests/shell/stat+shadow_stat.sh

index 8bae9c8a835e13a92cc33e920c5fb7bf6dd684f6..323123ff4d193dbfa86e2524ddb04c40ed632143 100755 (executable)
@@ -10,7 +10,7 @@ set -e
 #
 perf stat -e cycles  -x' ' -I1000 --interval-count 1 --summary 2>&1 | \
 grep -e summary | \
-while read summary _num _event _run _pct
+while read summary _ _ _ _
 do
        if [ $summary != "summary" ]; then
                exit 1
@@ -23,7 +23,7 @@ done
 #
 perf stat -e cycles  -x' ' -I1000 --interval-count 1 --summary --no-csv-summary 2>&1 | \
 grep -e summary | \
-while read _num _event _run _pct
+while read _ _ _ _
 do
        exit 1
 done
index 7d9b9d597a500c4c19d964ff8359c023cba3f3a2..0c7d79a230eac2918c0a8a528c3a6824edea738d 100755 (executable)
@@ -16,7 +16,7 @@ test_global_aggr()
 {
        perf stat -a --no-big-num -e cycles,instructions sleep 1  2>&1 | \
        grep -e cycles -e instructions | \
-       while read num evt _hash ipc rest
+       while read num evt _ ipc rest
        do
                # skip not counted events
                if [ "$num" = "<not" ]; then
@@ -55,7 +55,7 @@ test_no_aggr()
 {
        perf stat -a -A --no-big-num -e cycles,instructions sleep 1  2>&1 | \
        grep ^CPU | \
-       while read cpu num evt _hash ipc rest
+       while read cpu num evt _ ipc rest
        do
                # skip not counted events
                if [ "$num" = "<not" ]; then