[PATCH 07/22] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase

Athira Rajeev atrajeev at linux.vnet.ibm.com
Wed Jun 21 18:30:06 AEST 2023


Running shellcheck on stat+csv_summary.sh throws below warnings:

   In tests/shell/stat+csv_summary.sh line 26:
   while read num event run pct
              ^-^ SC2034 (warning): num appears unused. Verify use (or export if used externally).
                  ^---^ SC2034 (warning): event appears unused. Verify use (or export if used externally).
                        ^-^ SC2034 (warning): run appears unused. Verify use (or export if used externally).
                            ^-^ SC2034 (warning): pct appears unused. Verify use (or export if used externally).

These variables are intentioanlly unused since they
are needed to parse through the output. Use "_" as a
prefix for these throw away variables.

Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
---
 tools/perf/tests/shell/stat+csv_summary.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/stat+csv_summary.sh b/tools/perf/tests/shell/stat+csv_summary.sh
index 5571ff75eb42..8bae9c8a835e 100755
--- a/tools/perf/tests/shell/stat+csv_summary.sh
+++ b/tools/perf/tests/shell/stat+csv_summary.sh
@@ -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 _num _event _run _pct
 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 _num _event _run _pct
 do
 	exit 1
 done
-- 
2.39.1



More information about the Linuxppc-dev mailing list