* [PATCH 01/22] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 02/22] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase Athira Rajeev
` (21 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel,
Akanksha J N
From: Akanksha J N <akanksha@linux.ibm.com>
Running shellcheck -S on probe_vfs_getname.sh, throws below warnings:
Before fix:
$ shellcheck -S warning trace+probe_vfs_getname.sh
In trace+probe_vfs_getname.sh line 13:
. $(dirname $0)/lib/probe.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
In trace+probe_vfs_getname.sh line 18:
. $(dirname $0)/lib/probe_vfs_getname.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
In trace+probe_vfs_getname.sh line 21:
evts=$(echo $(perf list syscalls:sys_enter_open* 2>/dev/null | grep -E 'open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/') | sed 's/ /,/')
^-- SC2046 (warning): Quote this to prevent word splitting.
Fix the shellcheck warnings by adding quotes to prevent word splitting.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Akanksha J N <akanksha@linux.ibm.com>
---
tools/perf/tests/shell/trace+probe_vfs_getname.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
index 0a4bac3dd77e..db2ff141f703 100755
--- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
@@ -10,15 +10,15 @@
# SPDX-License-Identifier: GPL-2.0
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
-. $(dirname $0)/lib/probe.sh
+. "$(dirname $0)"/lib/probe.sh
skip_if_no_perf_probe || exit 2
skip_if_no_perf_trace || exit 2
-. $(dirname $0)/lib/probe_vfs_getname.sh
+. "$(dirname $0)"/lib/probe_vfs_getname.sh
trace_open_vfs_getname() {
- evts=$(echo $(perf list syscalls:sys_enter_open* 2>/dev/null | grep -E 'open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/') | sed 's/ /,/')
+ evts="$(echo "$(perf list syscalls:sys_enter_open* 2>/dev/null | grep -E 'open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/')" | sed ':a;N;s:\n:,:g')"
perf trace -e $evts touch $file 2>&1 | \
grep -E " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open(at)?\((dfd: +CWD, +)?filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
}
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 02/22] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
2023-06-21 8:30 ` [PATCH 01/22] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 03/22] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase Athira Rajeev
` (20 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on probe_vfs_getname.sh throws below warning:
In tests/shell/probe_vfs_getname.sh line 7:
. $(dirname $0)/lib/probe.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
In tests/shell/probe_vfs_getname.sh line 11:
. $(dirname $0)/lib/probe_vfs_getname.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warning by adding quotes to avoid word splitting.
ShellCheck result with patch:
# shellcheck -S warning probe_vfs_getname.sh
#
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/probe_vfs_getname.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/probe_vfs_getname.sh b/tools/perf/tests/shell/probe_vfs_getname.sh
index 5d1b63d3f3e1..871243d6d03a 100755
--- a/tools/perf/tests/shell/probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/probe_vfs_getname.sh
@@ -4,11 +4,11 @@
# SPDX-License-Identifier: GPL-2.0
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
-. $(dirname $0)/lib/probe.sh
+. "$(dirname $0)"/lib/probe.sh
skip_if_no_perf_probe || exit 2
-. $(dirname $0)/lib/probe_vfs_getname.sh
+. "$(dirname $0)"/lib/probe_vfs_getname.sh
add_probe_vfs_getname || skip_if_no_debuginfo
err=$?
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 03/22] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
2023-06-21 8:30 ` [PATCH 01/22] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh Athira Rajeev
2023-06-21 8:30 ` [PATCH 02/22] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 04/22] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase Athira Rajeev
` (19 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on record_offcpu.sh throws below warning:
In tests/shell/record_offcpu.sh line 13:
trap - exit term int
^--^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
^--^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
^-^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
In tests/shell/record_offcpu.sh line 20:
trap trap_cleanup exit term int
^--^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
^--^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
^-^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
In tests/shell/record_offcpu.sh line 25:
if [ `id -u` != 0 ]
^-----^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warnings by:
- Capitalize signals(INT, TERM, EXIT) to avoid mixed/lower case naming of
signals.
- Adding quotes to avoid word splitting.
Result from shellcheck after patch changes:
$ shellcheck -S warning record_offcpu.sh
$
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/record_offcpu.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/shell/record_offcpu.sh b/tools/perf/tests/shell/record_offcpu.sh
index f062ae9a95e1..a0d14cd0aa79 100755
--- a/tools/perf/tests/shell/record_offcpu.sh
+++ b/tools/perf/tests/shell/record_offcpu.sh
@@ -10,19 +10,19 @@ perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
cleanup() {
rm -f ${perfdata}
rm -f ${perfdata}.old
- trap - exit term int
+ trap - EXIT TERM INT
}
trap_cleanup() {
cleanup
exit 1
}
-trap trap_cleanup exit term int
+trap trap_cleanup EXIT TERM INT
test_offcpu_priv() {
echo "Checking off-cpu privilege"
- if [ `id -u` != 0 ]
+ if [ "$(id -u)" != 0 ]
then
echo "off-cpu test [Skipped permission]"
err=2
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 04/22] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (2 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 03/22] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 05/22] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase Athira Rajeev
` (18 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
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: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/lock_contention.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/tests/shell/lock_contention.sh b/tools/perf/tests/shell/lock_contention.sh
index f2cc187b6186..51421f02fb02 100755
--- a/tools/perf/tests/shell/lock_contention.sh
+++ b/tools/perf/tests/shell/lock_contention.sh
@@ -21,7 +21,7 @@ trap_cleanup() {
trap trap_cleanup EXIT TERM INT
check() {
- if [ `id -u` != 0 ]; then
+ if [ "$(id -u)" != 0 ]; then
echo "[Skip] No root permission"
err=2
exit
@@ -157,10 +157,10 @@ test_lock_filter()
perf lock contention -i ${perfdata} -L tasklist_lock -q 2> ${result}
# find out the type of tasklist_lock
- local type=$(head -1 "${result}" | awk '{ print $8 }' | sed -e 's/:.*//')
+ test_lock_filter_type=$(head -1 "${result}" | awk '{ print $8 }' | sed -e 's/:.*//')
- if [ "$(grep -c -v "${type}" "${result}")" != "0" ]; then
- echo "[Fail] Recorded result should not have non-${type} locks:" "$(cat "${result}")"
+ if [ "$(grep -c -v "${test_lock_filter_type}" "${result}")" != "0" ]; then
+ echo "[Fail] Recorded result should not have non-${test_lock_filter_type} locks:" "$(cat "${result}")"
err=1
exit
fi
@@ -170,8 +170,8 @@ test_lock_filter()
fi
perf lock con -a -b -L tasklist_lock -q -- perf bench sched messaging > /dev/null 2> ${result}
- if [ "$(grep -c -v "${type}" "${result}")" != "0" ]; then
- echo "[Fail] BPF result should not have non-${type} locks:" "$(cat "${result}")"
+ if [ "$(grep -c -v "${test_lock_filter_type}" "${result}")" != "0" ]; then
+ echo "[Fail] BPF result should not have non-${test_lock_filter_type} locks:" "$(cat "${result}")"
err=1
exit
fi
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 05/22] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (3 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 04/22] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 06/22] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues Athira Rajeev
` (17 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on lock_contention.sh generates below warning:
In stat_bpf_counters_cgrp.sh line 28:
if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; then
^-- SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
In stat_bpf_counters_cgrp.sh line 34:
local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
^-------------^ 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.
In stat_bpf_counters_cgrp.sh line 51:
local output
^----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
In stat_bpf_counters_cgrp.sh line 65:
local output
^----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
Fixed above warnings by:
- Changing the expression [p -a q] to [p] && [q].
- Fixing shellcheck warnings for local usage, by prefixing
function name to the variable.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
.../tests/shell/stat_bpf_counters_cgrp.sh | 28 ++++++++-----------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
index d724855d097c..a74440a00b6b 100755
--- a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
+++ b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
@@ -25,22 +25,22 @@ check_bpf_counter()
find_cgroups()
{
# try usual systemd slices first
- if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; then
+ if [ -d /sys/fs/cgroup/system.slice ] && [ -d /sys/fs/cgroup/user.slice ]; then
test_cgroups="system.slice,user.slice"
return
fi
# try root and self cgroups
- local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
- if [ -z ${self_cgrp} ]; then
+ find_cgroups_self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
+ if [ -z ${find_cgroups_self_cgrp} ]; then
# cgroup v2 doesn't specify perf_event
- self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3)
+ find_cgroups_self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3)
fi
- if [ -z ${self_cgrp} ]; then
+ if [ -z ${find_cgroups_self_cgrp} ]; then
test_cgroups="/"
else
- test_cgroups="/,${self_cgrp}"
+ test_cgroups="/,${find_cgroups_self_cgrp}"
fi
}
@@ -48,13 +48,11 @@ find_cgroups()
# Just check if it runs without failure and has non-zero results.
check_system_wide_counted()
{
- local output
-
- output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, sleep 1 2>&1)
- if echo ${output} | grep -q -F "<not "; then
+ check_system_wide_counted_output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, sleep 1 2>&1)
+ if echo ${check_system_wide_counted_output} | grep -q -F "<not "; then
echo "Some system-wide events are not counted"
if [ "${verbose}" = "1" ]; then
- echo ${output}
+ echo ${check_system_wide_counted_output}
fi
exit 1
fi
@@ -62,13 +60,11 @@ check_system_wide_counted()
check_cpu_list_counted()
{
- local output
-
- output=$(perf stat -C 1 --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, taskset -c 1 sleep 1 2>&1)
- if echo ${output} | grep -q -F "<not "; then
+ check_cpu_list_counted_output=$(perf stat -C 1 --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, taskset -c 1 sleep 1 2>&1)
+ if echo ${check_cpu_list_counted_output} | grep -q -F "<not "; then
echo "Some CPU events are not counted"
if [ "${verbose}" = "1" ]; then
- echo ${output}
+ echo ${check_cpu_list_counted_output}
fi
exit 1
fi
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 06/22] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (4 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 05/22] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 07/22] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase Athira Rajeev
` (16 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck -S on test_arm_spe_fork.sh throws below warnings:
In tests/shell/test_arm_spe_fork.sh line 25:
trap cleanup_files exit term int
^--^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
^--^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
^-^ SC3049 (warning): In POSIX sh, using lower/mixed case for signal names is undefined.
Fixed this issue by using uppercase for "EXIT", "TERM" and
"INIT" signals to avoid using lower/mixed case for signal
names as input.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/test_arm_spe_fork.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/test_arm_spe_fork.sh b/tools/perf/tests/shell/test_arm_spe_fork.sh
index fad361675a1d..1a7e6a82d0e3 100755
--- a/tools/perf/tests/shell/test_arm_spe_fork.sh
+++ b/tools/perf/tests/shell/test_arm_spe_fork.sh
@@ -22,7 +22,7 @@ cleanup_files()
rm -f ${PERF_DATA}
}
-trap cleanup_files exit term int
+trap cleanup_files EXIT TERM INT
echo "Recording workload..."
perf record -o ${PERF_DATA} -e arm_spe/period=65536/ -vvv -- $TEST_PROGRAM > ${PERF_RECORD_LOG} 2>&1 &
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 07/22] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (5 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 06/22] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 08/22] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase Athira Rajeev
` (15 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
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@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
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 08/22] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (6 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 07/22] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 09/22] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase Athira Rajeev
` (14 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on test_perf_data_converter_json.sh throws
below warning:
In tests/shell/test_perf_data_converter_json.sh line 42:
if [ $(cat "${result}" | wc -l) -gt "0" ] ; then
^------------------------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warning by adding quotes to avoid word splitting.
ShellCheck result with patch:
# shellcheck -S warning test_perf_data_converter_json.sh
#
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/test_perf_data_converter_json.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/test_perf_data_converter_json.sh b/tools/perf/tests/shell/test_perf_data_converter_json.sh
index 72ac6c83231c..6ded58f98f55 100755
--- a/tools/perf/tests/shell/test_perf_data_converter_json.sh
+++ b/tools/perf/tests/shell/test_perf_data_converter_json.sh
@@ -39,7 +39,7 @@ test_json_converter_command()
echo "Testing Perf Data Convertion Command to JSON"
perf record -o "$perfdata" -F 99 -g -- perf test -w noploop > /dev/null 2>&1
perf data convert --to-json "$result" --force -i "$perfdata" >/dev/null 2>&1
- if [ $(cat "${result}" | wc -l) -gt "0" ] ; then
+ if [ "$(cat ${result} | wc -l)" -gt "0" ] ; then
echo "Perf Data Converter Command to JSON [SUCCESS]"
else
echo "Perf Data Converter Command to JSON [FAILED]"
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 09/22] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (7 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 08/22] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 10/22] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase Athira Rajeev
` (13 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on stat_bpf_counter.sh generates below
warning:
In tests/shell/stat_bpf_counters.sh line 34:
if [ "$base_cycles" == "<not" ]; then
^-- SC3014 (warning): In POSIX sh, == in place of = is undefined.
In tests/shell/stat_bpf_counters.sh line 39:
if [ "$bpf_cycles" == "<not" ]; then
^-- SC3014 (warning): In POSIX sh, == in place of = is undefined.
Fix this by using "=" instead of "==" to work for
all shells.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/stat_bpf_counters.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/stat_bpf_counters.sh b/tools/perf/tests/shell/stat_bpf_counters.sh
index 13473aeba489..513cd1e58e0e 100755
--- a/tools/perf/tests/shell/stat_bpf_counters.sh
+++ b/tools/perf/tests/shell/stat_bpf_counters.sh
@@ -31,12 +31,12 @@ if ! perf stat --bpf-counters true > /dev/null 2>&1; then
fi
base_cycles=$(perf stat --no-big-num -e cycles -- perf bench sched messaging -g 1 -l 100 -t 2>&1 | awk '/cycles/ {print $1}')
-if [ "$base_cycles" == "<not" ]; then
+if [ "$base_cycles" = "<not" ]; then
echo "Skipping: cycles event not counted"
exit 2
fi
bpf_cycles=$(perf stat --no-big-num --bpf-counters -e cycles -- perf bench sched messaging -g 1 -l 100 -t 2>&1 | awk '/cycles/ {print $1}')
-if [ "$bpf_cycles" == "<not" ]; then
+if [ "$bpf_cycles" = "<not" ]; then
echo "Failed: cycles not counted with --bpf-counters"
exit 1
fi
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 10/22] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (8 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 09/22] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 11/22] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script Athira Rajeev
` (12 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on stat+shadow_stat.sh generates below
warning:
In tests/shell/stat+shadow_stat.sh line 48:
while read cpu num evt hash ipc rest
^--^ SC2034 (warning): hash appears unused. Verify use (or export if used externally).
This variable is intentioanlly unused since it is
needed to parse through the output. Use "_" as a
prefix for this throw away variable.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/stat+shadow_stat.sh | 4 ++--
1 file 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 0e9cba84e757..a1918a15e36a 100755
--- a/tools/perf/tests/shell/stat+shadow_stat.sh
+++ b/tools/perf/tests/shell/stat+shadow_stat.sh
@@ -14,7 +14,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 _hash ipc rest
do
# skip not counted events
if [ "$num" = "<not" ]; then
@@ -45,7 +45,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 _hash ipc rest
do
# skip not counted events
if [ "$num" = "<not" ]; then
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 11/22] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (9 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 10/22] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 12/22] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh " Athira Rajeev
` (11 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on asm_pure_loop.sh throws below warning:
In coresight/asm_pure_loop.sh line 8:
. $(dirname $0)/../lib/coresight.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warning by adding quotes to avoid word splitting.
ShellCheck result with patch:
# shellcheck -S warning coresight/asm_pure_loop.sh
#
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/coresight/asm_pure_loop.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/coresight/asm_pure_loop.sh b/tools/perf/tests/shell/coresight/asm_pure_loop.sh
index 569e9d46162b..779bc8608e1e 100755
--- a/tools/perf/tests/shell/coresight/asm_pure_loop.sh
+++ b/tools/perf/tests/shell/coresight/asm_pure_loop.sh
@@ -5,7 +5,7 @@
# Carsten Haitzler <carsten.haitzler@arm.com>, 2021
TEST="asm_pure_loop"
-. $(dirname $0)/../lib/coresight.sh
+. "$(dirname $0)"/../lib/coresight.sh
ARGS=""
DATV="out"
DATA="$DATD/perf-$TEST-$DATV.data"
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 12/22] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh shell script
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (10 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 11/22] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 13/22] tools/perf/tests: Fix shellcheck warning for coresight.sh " Athira Rajeev
` (10 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on memcpy_thread_16k_10.sh throws below warning:
In memcpy_thread_16k_10.sh line 8:
. $(dirname $0)/../lib/coresight.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warning by adding quotes to avoid word splitting.
ShellCheck result with patch:
# shellcheck -S warning coresight/memcpy_thread_16k_10.sh
#
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh b/tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
index d21ba8545938..08a44e52ce9b 100755
--- a/tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
+++ b/tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
@@ -5,7 +5,7 @@
# Carsten Haitzler <carsten.haitzler@arm.com>, 2021
TEST="memcpy_thread"
-. $(dirname $0)/../lib/coresight.sh
+. "$(dirname $0)"/../lib/coresight.sh
ARGS="16 10 1"
DATV="16k_10"
DATA="$DATD/perf-$TEST-$DATV.data"
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 13/22] tools/perf/tests: Fix shellcheck warning for coresight.sh shell script
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (11 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 12/22] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh " Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-27 7:52 ` James Clark
2023-06-21 8:30 ` [PATCH 14/22] tools/perf/tests: Fix shellcheck warning for probe.sh " Athira Rajeev
` (9 subsequent siblings)
22 siblings, 1 reply; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on coresight.sh throws below warning:
In lib/coresight.sh line 1:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In lib/coresight.sh line 13:
PERFRECOPT="$PERFRECMEM -e cs_etm//u"
^--------^ SC2034 (warning): PERFRECOPT appears unused. Verify use (or export if used externally).
Fixed the warnings by:
- Adding shell directive
- Using export for PERFRECOPT variable
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/lib/coresight.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/lib/coresight.sh b/tools/perf/tests/shell/lib/coresight.sh
index 6c3d34ec64d8..c7d97a0186c7 100644
--- a/tools/perf/tests/shell/lib/coresight.sh
+++ b/tools/perf/tests/shell/lib/coresight.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Carsten Haitzler <carsten.haitzler@arm.com>, 2021
@@ -10,7 +11,7 @@
# perf record options for the perf tests to use
PERFRECMEM="-m ,16M"
-PERFRECOPT="$PERFRECMEM -e cs_etm//u"
+export PERFRECOPT="$PERFRECMEM -e cs_etm//u"
TOOLS=$(dirname $0)
DIR="$TOOLS/$TEST"
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 13/22] tools/perf/tests: Fix shellcheck warning for coresight.sh shell script
2023-06-21 8:30 ` [PATCH 13/22] tools/perf/tests: Fix shellcheck warning for coresight.sh " Athira Rajeev
@ 2023-06-27 7:52 ` James Clark
0 siblings, 0 replies; 26+ messages in thread
From: James Clark @ 2023-06-27 7:52 UTC (permalink / raw)
To: Athira Rajeev
Cc: linux-perf-users, linuxppc-dev, maddy, kjain, disgoel, acme,
jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
On 21/06/2023 09:30, Athira Rajeev wrote:
> From: Kajol Jain <kjain@linux.ibm.com>
>
> Running shellcheck on coresight.sh throws below warning:
>
> In lib/coresight.sh line 1:
> ^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
>
> In lib/coresight.sh line 13:
> PERFRECOPT="$PERFRECMEM -e cs_etm//u"
> ^--------^ SC2034 (warning): PERFRECOPT appears unused. Verify use (or export if used externally).
>
> Fixed the warnings by:
> - Adding shell directive
> - Using export for PERFRECOPT variable
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
> tools/perf/tests/shell/lib/coresight.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/shell/lib/coresight.sh b/tools/perf/tests/shell/lib/coresight.sh
> index 6c3d34ec64d8..c7d97a0186c7 100644
> --- a/tools/perf/tests/shell/lib/coresight.sh
> +++ b/tools/perf/tests/shell/lib/coresight.sh
> @@ -1,3 +1,4 @@
> +#!/bin/bash
There is a comment a couple of lines below this that says the shebang
was excluded for a reason. It's probably worth leaving it excluded or
updating the comment.
> # SPDX-License-Identifier: GPL-2.0
> # Carsten Haitzler <carsten.haitzler@arm.com>, 2021
>
> @@ -10,7 +11,7 @@
>
> # perf record options for the perf tests to use
> PERFRECMEM="-m ,16M"
> -PERFRECOPT="$PERFRECMEM -e cs_etm//u"
> +export PERFRECOPT="$PERFRECMEM -e cs_etm//u"
This might silence the warning, but there are other variables like DATD
that are used in the sub-test scripts in the same way. They just don't
trigger the warning because they're also used in the top level one.
I think this change makes the code more misleading than solving any
problems. The coresight.sh script is sourced in the same process as the
sub tests so exporting variables isn't needed which is why it already
works without this change.
>
> TOOLS=$(dirname $0)
> DIR="$TOOLS/$TEST"
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 14/22] tools/perf/tests: Fix shellcheck warning for probe.sh shell script
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (12 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 13/22] tools/perf/tests: Fix shellcheck warning for coresight.sh " Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 15/22] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script Athira Rajeev
` (8 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on probe.sh throws below warning:
In lib/probe.sh line 1:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
Fixed the warnings by adding shell directive.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/lib/probe.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/tests/shell/lib/probe.sh b/tools/perf/tests/shell/lib/probe.sh
index 51e3f60baba0..5aa6e2ec5734 100644
--- a/tools/perf/tests/shell/lib/probe.sh
+++ b/tools/perf/tests/shell/lib/probe.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 15/22] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (13 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 14/22] tools/perf/tests: Fix shellcheck warning for probe.sh " Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 16/22] tools/perf: Fix shellcheck issue for check-headers.sh script Athira Rajeev
` (7 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on arch_errno_names.sh generates below warning:
In arch_errno_names.sh line 20:
local arch="$1"
^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
......
In arch_errno_names.sh line 61:
local arch
^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
In arch_errno_names.sh line 67:
printf '\t\treturn errno_to_name__%s(err);\n' $(arch_string "$arch")
^--------------------^ SC2046 (warning): Quote this to prevent word splitting.
In arch_errno_names.sh line 69:
printf '\treturn errno_to_name__%s(err);\n' $(arch_string "$default")
^-----------------------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warnings by:
- Fixing shellcheck warnings for local usage, by removing
local from the variable names
- Adding quotes to avoid word splitting
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/trace/beauty/arch_errno_names.sh | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
index 37c53bac5f56..cc09dcaa891e 100755
--- a/tools/perf/trace/beauty/arch_errno_names.sh
+++ b/tools/perf/trace/beauty/arch_errno_names.sh
@@ -17,8 +17,7 @@ arch_string()
asm_errno_file()
{
- local arch="$1"
- local header
+ arch="$1"
header="$toolsdir/arch/$arch/include/uapi/asm/errno.h"
if test -r "$header"; then
@@ -30,8 +29,7 @@ asm_errno_file()
create_errno_lookup_func()
{
- local arch=$(arch_string "$1")
- local nr name
+ arch=$(arch_string "$1")
printf "static const char *errno_to_name__%s(int err)\n{\n\tswitch (err) {\n" $arch
@@ -44,8 +42,8 @@ create_errno_lookup_func()
process_arch()
{
- local arch="$1"
- local asm_errno=$(asm_errno_file "$arch")
+ arch="$1"
+ asm_errno=$(asm_errno_file "$arch")
$gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
|grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
@@ -56,9 +54,8 @@ process_arch()
create_arch_errno_table_func()
{
- local archlist="$1"
- local default="$2"
- local arch
+ archlist="$1"
+ default="$2"
printf 'const char *arch_syscalls__strerrno(const char *arch, int err)\n'
printf '{\n'
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 16/22] tools/perf: Fix shellcheck issue for check-headers.sh script
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (14 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 15/22] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 17/22] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh Athira Rajeev
` (6 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on check-headers.sh generates below warning:
In check-headers.sh line 126:
check_2 "tools/$file" "$file" $*
^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
In check-headers.sh line 134:
check_2 "tools/perf/trace/beauty/$file" "$file" $*
^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.
In check-headers.sh line 186:
cd tools/perf
^-----------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Fixed the warnings by:
- Using "$@" instead of $*
- Adding exit condition with cd command
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
| 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index a0f1d8adce60..4314c9197850 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -123,7 +123,7 @@ check () {
shift
- check_2 "tools/$file" "$file" $*
+ check_2 "tools/$file" "$file" "$@"
}
beauty_check () {
@@ -131,7 +131,7 @@ beauty_check () {
shift
- check_2 "tools/perf/trace/beauty/$file" "$file" $*
+ check_2 "tools/perf/trace/beauty/$file" "$file" "$@"
}
# Check if we have the kernel headers (tools/perf/../../include), else
@@ -183,7 +183,7 @@ done
check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
-cd tools/perf
+cd tools/perf || exit
if [ ${#FAILURES[@]} -gt 0 ]
then
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 17/22] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (15 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 16/22] tools/perf: Fix shellcheck issue for check-headers.sh script Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 18/22] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh Athira Rajeev
` (5 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Fix the shellcheck warnings for thread_loop_check_tid_10.sh
In ./tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh line 8:
. $(dirname $0)/../lib/coresight.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
Add quotes to prevent word splitting which are caused by
unquoted command expansions.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh b/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
index 7c13636fc778..c83a200dede4 100755
--- a/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
+++ b/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
@@ -5,7 +5,7 @@
# Carsten Haitzler <carsten.haitzler@arm.com>, 2021
TEST="thread_loop"
-. $(dirname $0)/../lib/coresight.sh
+. "$(dirname $0)"/../lib/coresight.sh
ARGS="10 1"
DATV="check-tid-10th"
DATA="$DATD/perf-$TEST-$DATV.data"
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 18/22] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (16 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 17/22] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 19/22] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh Athira Rajeev
` (4 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Fix the shellcheck warnings for unroll_loop_thread_10.sh
Add quotes to prevent word splitting which are caused by
unquoted command expansions.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh b/tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
index f48c85230b15..7304e3d3a6ff 100755
--- a/tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
+++ b/tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
@@ -5,7 +5,7 @@
# Carsten Haitzler <carsten.haitzler@arm.com>, 2021
TEST="unroll_loop_thread"
-. $(dirname $0)/../lib/coresight.sh
+. "$(dirname $0)"/../lib/coresight.sh
ARGS="10"
DATV="10"
DATA="$DATD/perf-$TEST-$DATV.data"
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 19/22] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (17 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 18/22] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 20/22] tools/perf/tests: Fix the shellcheck wanrings in lib/waiting.sh Athira Rajeev
` (3 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on probe_vfs_getname fails with below
warning:
In ./tools/perf/tests/shell/lib/probe_vfs_getname.sh line 1:
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In ./tools/perf/tests/shell/lib/probe_vfs_getname.sh line 14:
local verbose=$1
^-----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
Fix this:
- by adding shebang in the beginning of the file and
- rename variable verbose to "add_probe_verbose" after removing
local
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/lib/probe_vfs_getname.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
index 60c5e34f90c4..bf4c1fb71c4b 100644
--- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
perf probe -l 2>&1 | grep -q probe:vfs_getname
@@ -10,11 +11,11 @@ cleanup_probe_vfs_getname() {
}
add_probe_vfs_getname() {
- local verbose=$1
+ add_probe_verbose=$1
if [ $had_vfs_getname -eq 1 ] ; then
line=$(perf probe -L getname_flags 2>&1 | grep -E 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
- perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
+ perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
fi
}
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 20/22] tools/perf/tests: Fix the shellcheck wanrings in lib/waiting.sh
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (18 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 19/22] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 21/22] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings Athira Rajeev
` (2 subsequent siblings)
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck in "lib/waiting.sh" generates below
warning:
In ./tools/perf/tests/shell/lib/waiting.sh line 1:
# SPDX-License-Identifier: GPL-2.0
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
Fix this by adding shebang in the beginning of the script.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/lib/waiting.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/tests/shell/lib/waiting.sh b/tools/perf/tests/shell/lib/waiting.sh
index e7a39134a68e..bdd5a7c71591 100644
--- a/tools/perf/tests/shell/lib/waiting.sh
+++ b/tools/perf/tests/shell/lib/waiting.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
tenths=date\ +%s%1N
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 21/22] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (19 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 20/22] tools/perf/tests: Fix the shellcheck wanrings in lib/waiting.sh Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-21 8:30 ` [PATCH 22/22] tools/perf/arch/x86: Fix syscalltbl.sh " Athira Rajeev
2023-06-23 23:40 ` [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Namhyung Kim
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on x86_arch_prctl.sh generates below warning:
In ./tools/perf/trace/beauty/x86_arch_prctl.sh line 10:
local idx=$1
^-------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
In ./tools/perf/trace/beauty/x86_arch_prctl.sh line 11:
local prefix=$2
^----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
In ./tools/perf/trace/beauty/x86_arch_prctl.sh line 12:
local first_entry=$3
^---------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
Fix this by removing local since these are variables
used only in specific function
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/trace/beauty/x86_arch_prctl.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/trace/beauty/x86_arch_prctl.sh b/tools/perf/trace/beauty/x86_arch_prctl.sh
index fd5c740512c5..b1596df251f0 100755
--- a/tools/perf/trace/beauty/x86_arch_prctl.sh
+++ b/tools/perf/trace/beauty/x86_arch_prctl.sh
@@ -7,9 +7,9 @@
prctl_arch_header=${x86_header_dir}/prctl.h
print_range () {
- local idx=$1
- local prefix=$2
- local first_entry=$3
+ idx=$1
+ prefix=$2
+ first_entry=$3
printf "#define x86_arch_prctl_codes_%d_offset %s\n" $idx $first_entry
printf "static const char *x86_arch_prctl_codes_%d[] = {\n" $idx
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 22/22] tools/perf/arch/x86: Fix syscalltbl.sh to address shellcheck warnings
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (20 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 21/22] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings Athira Rajeev
@ 2023-06-21 8:30 ` Athira Rajeev
2023-06-23 23:40 ` [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Namhyung Kim
22 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-21 8:30 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung, ravi.bangoria, john.g.garry
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on syscalltbl.sh generates below warning:
In ./tools/perf/arch/x86/entry/syscalls/syscalltbl.sh line 27:
while read nr abi name entry compat; do
^-^ SC2034 (warning): abi appears unused. Verify use (or export if used externally).
^----^ SC2034 (warning): compat 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@linux.vnet.ibm.com>
---
tools/perf/arch/x86/entry/syscalls/syscalltbl.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh b/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh
index fa526a993845..59d7914ed6bb 100755
--- a/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh
+++ b/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh
@@ -24,7 +24,7 @@ sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX)
grep '^[0-9]' "$in" | sort -n > $sorted_table
max_nr=0
-while read nr abi name entry compat; do
+while read nr _abi name entry _compat; do
if [ $nr -ge 512 ] ; then # discard compat sycalls
break
fi
--
2.39.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-06-21 8:29 [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (21 preceding siblings ...)
2023-06-21 8:30 ` [PATCH 22/22] tools/perf/arch/x86: Fix syscalltbl.sh " Athira Rajeev
@ 2023-06-23 23:40 ` Namhyung Kim
2023-06-27 7:12 ` Athira Rajeev
22 siblings, 1 reply; 26+ messages in thread
From: Namhyung Kim @ 2023-06-23 23:40 UTC (permalink / raw)
To: Athira Rajeev
Cc: acme, jolsa, irogers, ravi.bangoria, john.g.garry,
linux-perf-users, linuxppc-dev, maddy, kjain, disgoel
Hello,
On Wed, Jun 21, 2023 at 1:30 AM Athira Rajeev
<atrajeev@linux.vnet.ibm.com> wrote:
>
> Patchset covers a set of fixes for coding/formatting issues observed while
> running shellcheck tool on the perf shell scripts.
>
> This cleanup is a pre-requisite to include a build option for shellcheck
> discussed here: https://www.spinics.net/lists/linux-perf-users/msg25553.html
> First set of patches were posted here:
> https://lore.kernel.org/linux-perf-users/53B7D823-1570-4289-A632-2205EE2B522C@linux.vnet.ibm.com/T/#t
>
> This patchset covers remaining set of shell scripts which needs
> fix. Patch 1 is resubmission of patch 6 from the initial series.
> Patch 15, 16 and 22 touches code from tools/perf/trace/beauty.
> Other patches are fixes for scripts from tools/perf/tests.
Thanks for this work. But it seems there are some issues
even after applying this series.
$ for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do
> shellcheck $F; done | grep -c -e '(info)' -e '(warning)'
29
$ for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do
> shellcheck $F; done | grep ^In
In tests/shell/pipe_test.sh line 10:
In tests/shell/pipe_test.sh line 15:
In tests/shell/pipe_test.sh line 20:
In tests/shell/pipe_test.sh line 21:
In tests/shell/pipe_test.sh line 26:
In tests/shell/pipe_test.sh line 27:
In tests/shell/pipe_test.sh line 33:
In tests/shell/record+zstd_comp_decomp.sh line 16:
In tests/shell/record+zstd_comp_decomp.sh line 22:
In tests/shell/record+zstd_comp_decomp.sh line 27:
In tests/shell/record+zstd_comp_decomp.sh line 28:
In tests/shell/record+zstd_comp_decomp.sh line 29:
In tests/shell/record+zstd_comp_decomp.sh line 30:
In tests/shell/record+zstd_comp_decomp.sh line 36:
In tests/shell/coresight/thread_loop_check_tid_2.sh line 8:
In tests/shell/coresight/thread_loop_check_tid_2.sh line 11:
In tests/shell/coresight/thread_loop_check_tid_2.sh line 14:
Also unfortunately there's some update in the shell tests.
Please rebase onto the perf-tools-next.
Thanks,
Namhyung
>
> Akanksha J N (1):
> tools/perf/tests: Fix shellcheck warnings for
> trace+probe_vfs_getname.sh
>
> Athira Rajeev (11):
> tools/perf/tests: fix test_arm_spe_fork.sh signal case issues
> tools/perf/tests: Fix unused variable references in
> stat+csv_summary.sh testcase
> tools/perf/tests: fix shellcheck warning for
> test_perf_data_converter_json.sh testcase
> tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh
> testcase
> tools/perf/tests: Fix shellcheck issues in
> tests/shell/stat+shadow_stat.sh tetscase
> tools/perf/tests: Fix shellcheck warnings for
> thread_loop_check_tid_10.sh
> tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh
> tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh
> tools/perf/tests: Fix the shellcheck wanrings in lib/waiting.sh
> tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings
> tools/perf/arch/x86: Fix syscalltbl.sh to address shellcheck warnings
>
> Kajol Jain (10):
> tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh
> testcase
> tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase
> tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase
> tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh
> testcase
> tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell
> script
> tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh
> shell script
> tools/perf/tests: Fix shellcheck warning for coresight.sh shell script
> tools/perf/tests: Fix shellcheck warning for probe.sh shell script
> tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script
> tools/perf: Fix shellcheck issue for check-headers.sh script
>
> .../arch/x86/entry/syscalls/syscalltbl.sh | 2 +-
> tools/perf/check-headers.sh | 6 ++--
> .../tests/shell/coresight/asm_pure_loop.sh | 2 +-
> .../shell/coresight/memcpy_thread_16k_10.sh | 2 +-
> .../coresight/thread_loop_check_tid_10.sh | 2 +-
> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
> tools/perf/tests/shell/lib/coresight.sh | 3 +-
> tools/perf/tests/shell/lib/probe.sh | 1 +
> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
> tools/perf/tests/shell/lib/waiting.sh | 1 +
> tools/perf/tests/shell/lock_contention.sh | 12 ++++----
> tools/perf/tests/shell/probe_vfs_getname.sh | 4 +--
> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
> tools/perf/tests/shell/stat_bpf_counters.sh | 4 +--
> .../tests/shell/stat_bpf_counters_cgrp.sh | 28 ++++++++-----------
> tools/perf/tests/shell/test_arm_spe_fork.sh | 2 +-
> .../shell/test_perf_data_converter_json.sh | 2 +-
> .../tests/shell/trace+probe_vfs_getname.sh | 6 ++--
> tools/perf/trace/beauty/arch_errno_names.sh | 15 ++++------
> tools/perf/trace/beauty/x86_arch_prctl.sh | 6 ++--
> 22 files changed, 58 insertions(+), 61 deletions(-)
>
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-06-23 23:40 ` [PATCH 00/22] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Namhyung Kim
@ 2023-06-27 7:12 ` Athira Rajeev
0 siblings, 0 replies; 26+ messages in thread
From: Athira Rajeev @ 2023-06-27 7:12 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ian Rogers, Madhavan Srinivasan, john.g.garry, Kajol Jain,
Ravi Bangoria, Arnaldo Carvalho de Melo, linux-perf-users,
Jiri Olsa, Disha Goel, linuxppc-dev
> On 24-Jun-2023, at 5:10 AM, Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hello,
>
> On Wed, Jun 21, 2023 at 1:30 AM Athira Rajeev
> <atrajeev@linux.vnet.ibm.com> wrote:
>>
>> Patchset covers a set of fixes for coding/formatting issues observed while
>> running shellcheck tool on the perf shell scripts.
>>
>> This cleanup is a pre-requisite to include a build option for shellcheck
>> discussed here: https://www.spinics.net/lists/linux-perf-users/msg25553.html
>> First set of patches were posted here:
>> https://lore.kernel.org/linux-perf-users/53B7D823-1570-4289-A632-2205EE2B522C@linux.vnet.ibm.com/T/#t
>>
>> This patchset covers remaining set of shell scripts which needs
>> fix. Patch 1 is resubmission of patch 6 from the initial series.
>> Patch 15, 16 and 22 touches code from tools/perf/trace/beauty.
>> Other patches are fixes for scripts from tools/perf/tests.
>
> Thanks for this work. But it seems there are some issues
> even after applying this series.
>
> $ for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do
>> shellcheck $F; done | grep -c -e '(info)' -e '(warning)'
> 29
>
> $ for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do
>> shellcheck $F; done | grep ^In
> In tests/shell/pipe_test.sh line 10:
> In tests/shell/pipe_test.sh line 15:
> In tests/shell/pipe_test.sh line 20:
> In tests/shell/pipe_test.sh line 21:
> In tests/shell/pipe_test.sh line 26:
> In tests/shell/pipe_test.sh line 27:
> In tests/shell/pipe_test.sh line 33:
> In tests/shell/record+zstd_comp_decomp.sh line 16:
> In tests/shell/record+zstd_comp_decomp.sh line 22:
> In tests/shell/record+zstd_comp_decomp.sh line 27:
> In tests/shell/record+zstd_comp_decomp.sh line 28:
> In tests/shell/record+zstd_comp_decomp.sh line 29:
> In tests/shell/record+zstd_comp_decomp.sh line 30:
> In tests/shell/record+zstd_comp_decomp.sh line 36:
> In tests/shell/coresight/thread_loop_check_tid_2.sh line 8:
> In tests/shell/coresight/thread_loop_check_tid_2.sh line 11:
> In tests/shell/coresight/thread_loop_check_tid_2.sh line 14:
>
> Also unfortunately there's some update in the shell tests.
> Please rebase onto the perf-tools-next.
Hi Namhyung
Thanks for checking. Will send an updated version on top of perf-tools-next
Thanks
Athira
>
> Thanks,
> Namhyung
>
>
>>
>> Akanksha J N (1):
>> tools/perf/tests: Fix shellcheck warnings for
>> trace+probe_vfs_getname.sh
>>
>> Athira Rajeev (11):
>> tools/perf/tests: fix test_arm_spe_fork.sh signal case issues
>> tools/perf/tests: Fix unused variable references in
>> stat+csv_summary.sh testcase
>> tools/perf/tests: fix shellcheck warning for
>> test_perf_data_converter_json.sh testcase
>> tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh
>> testcase
>> tools/perf/tests: Fix shellcheck issues in
>> tests/shell/stat+shadow_stat.sh tetscase
>> tools/perf/tests: Fix shellcheck warnings for
>> thread_loop_check_tid_10.sh
>> tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh
>> tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh
>> tools/perf/tests: Fix the shellcheck wanrings in lib/waiting.sh
>> tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings
>> tools/perf/arch/x86: Fix syscalltbl.sh to address shellcheck warnings
>>
>> Kajol Jain (10):
>> tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh
>> testcase
>> tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase
>> tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase
>> tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh
>> testcase
>> tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell
>> script
>> tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh
>> shell script
>> tools/perf/tests: Fix shellcheck warning for coresight.sh shell script
>> tools/perf/tests: Fix shellcheck warning for probe.sh shell script
>> tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script
>> tools/perf: Fix shellcheck issue for check-headers.sh script
>>
>> .../arch/x86/entry/syscalls/syscalltbl.sh | 2 +-
>> tools/perf/check-headers.sh | 6 ++--
>> .../tests/shell/coresight/asm_pure_loop.sh | 2 +-
>> .../shell/coresight/memcpy_thread_16k_10.sh | 2 +-
>> .../coresight/thread_loop_check_tid_10.sh | 2 +-
>> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
>> tools/perf/tests/shell/lib/coresight.sh | 3 +-
>> tools/perf/tests/shell/lib/probe.sh | 1 +
>> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
>> tools/perf/tests/shell/lib/waiting.sh | 1 +
>> tools/perf/tests/shell/lock_contention.sh | 12 ++++----
>> tools/perf/tests/shell/probe_vfs_getname.sh | 4 +--
>> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
>> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
>> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
>> tools/perf/tests/shell/stat_bpf_counters.sh | 4 +--
>> .../tests/shell/stat_bpf_counters_cgrp.sh | 28 ++++++++-----------
>> tools/perf/tests/shell/test_arm_spe_fork.sh | 2 +-
>> .../shell/test_perf_data_converter_json.sh | 2 +-
>> .../tests/shell/trace+probe_vfs_getname.sh | 6 ++--
>> tools/perf/trace/beauty/arch_errno_names.sh | 15 ++++------
>> tools/perf/trace/beauty/x86_arch_prctl.sh | 6 ++--
>> 22 files changed, 58 insertions(+), 61 deletions(-)
>>
>> --
>> 2.39.1
^ permalink raw reply [flat|nested] 26+ messages in thread