* [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
@ 2023-07-09 18:27 Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 01/26] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh Athira Rajeev
` (26 more replies)
0 siblings, 27 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
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.
The shellcheck is run for severity level for errors and warnings.
Command used:
# for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
# echo $?
0
Changelog:
v1 -> v2:
- Rebased on top of perf-tools-next from:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
- Fixed shellcheck errors and warnings reported for newly
added changes from perf-tools-next branch
- Addressed review comment from James clark for patch
number 13 from V1. The changes in patch 13 were not necessary
since the file "tests/shell/lib/coresight.sh" is sourced from
other test files.
Akanksha J N (1):
tools/perf/tests: Fix shellcheck warnings for
trace+probe_vfs_getname.sh
Athira Rajeev (14):
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 warnings 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
tools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.sh
tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
testcase
tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
testcase
Kajol Jain (11):
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 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
tools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.sh shell script
tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
shell 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 +-
.../coresight/thread_loop_check_tid_2.sh | 2 +-
.../shell/coresight/unroll_loop_thread_10.sh | 2 +-
tools/perf/tests/shell/lib/probe.sh | 1 +
.../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
tools/perf/tests/shell/lib/stat_output.sh | 1 +
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 +--
.../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
tools/perf/tests/shell/record_offcpu.sh | 6 ++--
tools/perf/tests/shell/stat+csv_output.sh | 2 +-
tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
tools/perf/tests/shell/stat+std_output.sh | 3 +-
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 ++--
26 files changed, 67 insertions(+), 71 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH V2 01/26] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 02/26] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase Athira Rajeev
` (25 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 02/26] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 01/26] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 03/26] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase Athira Rajeev
` (24 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 03/26] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 01/26] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 02/26] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 04/26] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase Athira Rajeev
` (23 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 04/26] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (2 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 03/26] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 05/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase Athira Rajeev
` (22 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 05/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (3 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 04/26] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 06/26] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues Athira Rajeev
` (21 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 06/26] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (4 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 05/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 07/26] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase Athira Rajeev
` (20 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 07/26] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (5 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 06/26] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 08/26] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase Athira Rajeev
` (19 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 08/26] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (6 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 07/26] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 09/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase Athira Rajeev
` (18 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 09/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (7 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 08/26] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 10/26] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase Athira Rajeev
` (17 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 10/26] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (8 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 09/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 11/26] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script Athira Rajeev
` (16 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 11/26] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (9 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 10/26] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 12/26] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh " Athira Rajeev
` (15 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 12/26] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh shell script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (10 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 11/26] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 13/26] tools/perf/tests: Fix shellcheck warning for probe.sh " Athira Rajeev
` (14 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 13/26] tools/perf/tests: Fix shellcheck warning for probe.sh shell script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (11 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 12/26] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh " Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 14/26] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script Athira Rajeev
` (13 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 14/26] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (12 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 13/26] tools/perf/tests: Fix shellcheck warning for probe.sh " Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 15/26] tools/perf: Fix shellcheck issue for check-headers.sh script Athira Rajeev
` (12 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 15/26] tools/perf: Fix shellcheck issue for check-headers.sh script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (13 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 14/26] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 16/26] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh Athira Rajeev
` (11 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 16/26] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (14 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 15/26] tools/perf: Fix shellcheck issue for check-headers.sh script Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 17/26] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh Athira Rajeev
` (10 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 17/26] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (15 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 16/26] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 18/26] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh Athira Rajeev
` (9 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 18/26] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (16 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 17/26] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 19/26] tools/perf/tests: Fix the shellcheck warnings in lib/waiting.sh Athira Rajeev
` (8 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 19/26] tools/perf/tests: Fix the shellcheck warnings in lib/waiting.sh
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (17 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 18/26] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 20/26] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings Athira Rajeev
` (7 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 20/26] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (18 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 19/26] tools/perf/tests: Fix the shellcheck warnings in lib/waiting.sh Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 21/26] tools/perf/arch/x86: Fix syscalltbl.sh " Athira Rajeev
` (6 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 21/26] tools/perf/arch/x86: Fix syscalltbl.sh to address shellcheck warnings
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (19 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 20/26] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 22/26] tools/perf/tests/shell: Fix the shellcheck warnings in record+zstd_comp_decomp.sh Athira Rajeev
` (5 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
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] 33+ messages in thread
* [PATCH V2 22/26] tools/perf/tests/shell: Fix the shellcheck warnings in record+zstd_comp_decomp.sh
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (20 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 21/26] tools/perf/arch/x86: Fix syscalltbl.sh " Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 23/26] tools/shell/coresight: Fix shellcheck warning for thread_loop_check_tid_2.sh shell script Athira Rajeev
` (4 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on record+zstd_comp_decomp.sh testcases
throws below warning:
In tests/shell/record+zstd_comp_decomp.sh line 16:
$perf_tool record -o $trace_file $gflag -z -F 5000 -- \
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$perf_tool record -o "$trace_file" $gflag -z -F 5000 -- \
In tests/shell/record+zstd_comp_decomp.sh line 22:
$perf_tool report -i $trace_file --header --stats | \
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Added double quote around file names to fix these
shellcheck reported issues.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/record+zstd_comp_decomp.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/perf/tests/shell/record+zstd_comp_decomp.sh b/tools/perf/tests/shell/record+zstd_comp_decomp.sh
index 49bd875d5122..8929046e9057 100755
--- a/tools/perf/tests/shell/record+zstd_comp_decomp.sh
+++ b/tools/perf/tests/shell/record+zstd_comp_decomp.sh
@@ -13,25 +13,25 @@ skip_if_no_z_record() {
collect_z_record() {
echo "Collecting compressed record file:"
[ "$(uname -m)" != s390x ] && gflag='-g'
- $perf_tool record -o $trace_file $gflag -z -F 5000 -- \
+ $perf_tool record -o "$trace_file" $gflag -z -F 5000 -- \
dd count=500 if=/dev/urandom of=/dev/null
}
check_compressed_stats() {
echo "Checking compressed events stats:"
- $perf_tool report -i $trace_file --header --stats | \
+ $perf_tool report -i "$trace_file" --header --stats | \
grep -E "(# compressed : Zstd,)|(COMPRESSED events:)"
}
check_compressed_output() {
- $perf_tool inject -i $trace_file -o $trace_file.decomp &&
- $perf_tool report -i $trace_file --stdio -F comm,dso,sym | head -n -3 > $trace_file.comp.output &&
- $perf_tool report -i $trace_file.decomp --stdio -F comm,dso,sym | head -n -3 > $trace_file.decomp.output &&
- diff $trace_file.comp.output $trace_file.decomp.output
+ $perf_tool inject -i "$trace_file" -o "$trace_file.decomp" &&
+ $perf_tool report -i "$trace_file" --stdio -F comm,dso,sym | head -n -3 > "$trace_file.comp.output" &&
+ $perf_tool report -i "$trace_file.decomp" --stdio -F comm,dso,sym | head -n -3 > "$trace_file.decomp.output" &&
+ diff "$trace_file.comp.output" "$trace_file.decomp.output"
}
skip_if_no_z_record || exit 2
collect_z_record && check_compressed_stats && check_compressed_output
err=$?
-rm -f $trace_file*
+rm -f "$trace_file*"
exit $err
--
2.39.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH V2 23/26] tools/shell/coresight: Fix shellcheck warning for thread_loop_check_tid_2.sh shell script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (21 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 22/26] tools/perf/tests/shell: Fix the shellcheck warnings in record+zstd_comp_decomp.sh Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 24/26] tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh " Athira Rajeev
` (3 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on thread_loop_check_tid_2.sh throws below warning:
In tests/shell/coresight/thread_loop_check_tid_2.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.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh b/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh
index a067145af43c..6346fd5e87c8 100755
--- a/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh
+++ b/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.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="2 20"
DATV="check-tid-2th"
DATA="$DATD/perf-$TEST-$DATV.data"
--
2.39.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH V2 24/26] tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh shell script
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (22 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 23/26] tools/shell/coresight: Fix shellcheck warning for thread_loop_check_tid_2.sh shell script Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 25/26] tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh testcase Athira Rajeev
` (2 subsequent siblings)
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
From: Kajol Jain <kjain@linux.ibm.com>
Running shellcheck on stat_output.sh throws below warning:
In tests/shell/lib/stat_output.sh line 1:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
Fixed the warning 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/stat_output.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/tests/shell/lib/stat_output.sh b/tools/perf/tests/shell/lib/stat_output.sh
index 363979b1123d..db2a53e6989c 100755
--- a/tools/perf/tests/shell/lib/stat_output.sh
+++ b/tools/perf/tests/shell/lib/stat_output.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Return true if perf_event_paranoid is > $1 and not running as root.
--
2.39.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH V2 25/26] tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (23 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 24/26] tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh " Athira Rajeev
@ 2023-07-09 18:27 ` Athira Rajeev
2023-07-09 18:28 ` [PATCH V2 26/26] tools/perf/tests: " Athira Rajeev
2023-07-19 6:17 ` [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts kajoljain
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:27 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on stat+csv_output.sh throws below
warning:
In tests/shell/stat+csv_output.sh line 9:
. $(dirname $0)/lib/stat_output.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warning by adding quotes to avoid word splitting.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/stat+csv_output.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/stat+csv_output.sh b/tools/perf/tests/shell/stat+csv_output.sh
index 34a0701fee05..d890eb26e914 100755
--- a/tools/perf/tests/shell/stat+csv_output.sh
+++ b/tools/perf/tests/shell/stat+csv_output.sh
@@ -6,7 +6,7 @@
set -e
-. $(dirname $0)/lib/stat_output.sh
+. "$(dirname $0)"/lib/stat_output.sh
csv_sep=@
--
2.39.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH V2 26/26] tools/perf/tests: Fix shellcheck warning for stat+std_output.sh testcase
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (24 preceding siblings ...)
2023-07-09 18:27 ` [PATCH V2 25/26] tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh testcase Athira Rajeev
@ 2023-07-09 18:28 ` Athira Rajeev
2023-07-19 6:17 ` [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts kajoljain
26 siblings, 0 replies; 33+ messages in thread
From: Athira Rajeev @ 2023-07-09 18:28 UTC (permalink / raw)
To: acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel
Running shellcheck on stat_std_output testcase throws
below warning:
In tests/shell/stat+std_output.sh line 9:
. $(dirname $0)/lib/stat_output.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
In tests/shell/stat+std_output.sh line 32:
local -i cnt=0
^-^ SC2034 (warning): cnt appears unused. Verify use (or export if used externally).
Fixed the warning by adding quotes to avoid word splitting
and removed unused variable "cnt" at line 32.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/stat+std_output.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/stat+std_output.sh b/tools/perf/tests/shell/stat+std_output.sh
index 98cc3356a04a..4bfef39baf0a 100755
--- a/tools/perf/tests/shell/stat+std_output.sh
+++ b/tools/perf/tests/shell/stat+std_output.sh
@@ -6,7 +6,7 @@
set -e
-. $(dirname $0)/lib/stat_output.sh
+. "$(dirname $0)"/lib/stat_output.sh
stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX)
@@ -29,7 +29,6 @@ trap trap_cleanup EXIT TERM INT
function commachecker()
{
- local -i cnt=0
local prefix=1
case "$1"
--
2.39.1
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
` (25 preceding siblings ...)
2023-07-09 18:28 ` [PATCH V2 26/26] tools/perf/tests: " Athira Rajeev
@ 2023-07-19 6:17 ` kajoljain
2023-07-19 17:46 ` Ian Rogers
26 siblings, 1 reply; 33+ messages in thread
From: kajoljain @ 2023-07-19 6:17 UTC (permalink / raw)
To: Athira Rajeev, acme, jolsa, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, maddy, disgoel
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol Jain
On 7/9/23 23:57, Athira Rajeev 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.
>
> The shellcheck is run for severity level for errors and warnings.
> Command used:
>
> # for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
> # echo $?
> 0
>
> Changelog:
> v1 -> v2:
> - Rebased on top of perf-tools-next from:
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
>
> - Fixed shellcheck errors and warnings reported for newly
> added changes from perf-tools-next branch
>
> - Addressed review comment from James clark for patch
> number 13 from V1. The changes in patch 13 were not necessary
> since the file "tests/shell/lib/coresight.sh" is sourced from
> other test files.
>
> Akanksha J N (1):
> tools/perf/tests: Fix shellcheck warnings for
> trace+probe_vfs_getname.sh
>
> Athira Rajeev (14):
> 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 warnings 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
> tools/perf/tests/shell: Fix the shellcheck warnings in
> record+zstd_comp_decomp.sh
> tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
> testcase
> tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
> testcase
>
> Kajol Jain (11):
> 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 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
> tools/shell/coresight: Fix shellcheck warning for
> thread_loop_check_tid_2.sh shell script
> tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
> shell 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 +-
> .../coresight/thread_loop_check_tid_2.sh | 2 +-
> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
> tools/perf/tests/shell/lib/probe.sh | 1 +
> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
> tools/perf/tests/shell/lib/stat_output.sh | 1 +
> 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 +--
> .../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
> tools/perf/tests/shell/stat+csv_output.sh | 2 +-
> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
> tools/perf/tests/shell/stat+std_output.sh | 3 +-
> 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 ++--
> 26 files changed, 67 insertions(+), 71 deletions(-)
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-07-19 6:17 ` [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts kajoljain
@ 2023-07-19 17:46 ` Ian Rogers
2023-07-20 5:12 ` Athira Rajeev
0 siblings, 1 reply; 33+ messages in thread
From: Ian Rogers @ 2023-07-19 17:46 UTC (permalink / raw)
To: kajoljain
Cc: Athira Rajeev, acme, jolsa, namhyung, linux-perf-users,
linuxppc-dev, maddy, disgoel
On Tue, Jul 18, 2023 at 11:17 PM kajoljain <kjain@linux.ibm.com> wrote:
>
> Hi,
>
> Looking for review comments on this patchset.
>
> Thanks,
> Kajol Jain
>
>
> On 7/9/23 23:57, Athira Rajeev 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.
> >
> > The shellcheck is run for severity level for errors and warnings.
> > Command used:
> >
> > # for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
> > # echo $?
> > 0
> >
I don't see anything objectionable in the changes so for the series:
Acked-by: Ian Rogers <irogers@google.com>
Some thoughts:
- Adding "#!/bin/bash" to scripts in tools/perf/tests/lib - I think
we didn't do this to avoid these being included as tests. There are
now extra checks when finding shell tests, so I can imagine doing this
isn't a regression but just a heads up.
- I think James' comment was addressed:
https://lore.kernel.org/linux-perf-users/334989bf-5501-494c-f246-81878fd2fed8@arm.com/
- Why aren't these changes being mailed to LKML? The wider community
on LKML have thoughts on shell scripts, plus it makes the changes miss
my mail filters.
- Can we automate this testing into the build? For example, following
a similar kernel build pattern we run a python test and make the log
output a requirement here:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n30
I think we can translate:
for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck
-S warning $F; done
into a rule in make for log files that are then a dependency on the
perf binary. We can then parallel shellcheck during the build and
avoid regressions. We probably need a CONFIG_SHELLCHECK feature check
in the build to avoid not having shellcheck breaking the build.
Thanks,
Ian
> > Changelog:
> > v1 -> v2:
> > - Rebased on top of perf-tools-next from:
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
> >
> > - Fixed shellcheck errors and warnings reported for newly
> > added changes from perf-tools-next branch
> >
> > - Addressed review comment from James clark for patch
> > number 13 from V1. The changes in patch 13 were not necessary
> > since the file "tests/shell/lib/coresight.sh" is sourced from
> > other test files.
> >
> > Akanksha J N (1):
> > tools/perf/tests: Fix shellcheck warnings for
> > trace+probe_vfs_getname.sh
> >
> > Athira Rajeev (14):
> > 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 warnings 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
> > tools/perf/tests/shell: Fix the shellcheck warnings in
> > record+zstd_comp_decomp.sh
> > tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
> > testcase
> > tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
> > testcase
> >
> > Kajol Jain (11):
> > 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 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
> > tools/shell/coresight: Fix shellcheck warning for
> > thread_loop_check_tid_2.sh shell script
> > tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
> > shell 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 +-
> > .../coresight/thread_loop_check_tid_2.sh | 2 +-
> > .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
> > tools/perf/tests/shell/lib/probe.sh | 1 +
> > .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
> > tools/perf/tests/shell/lib/stat_output.sh | 1 +
> > 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 +--
> > .../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
> > tools/perf/tests/shell/record_offcpu.sh | 6 ++--
> > tools/perf/tests/shell/stat+csv_output.sh | 2 +-
> > tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
> > tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
> > tools/perf/tests/shell/stat+std_output.sh | 3 +-
> > 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 ++--
> > 26 files changed, 67 insertions(+), 71 deletions(-)
> >
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-07-19 17:46 ` Ian Rogers
@ 2023-07-20 5:12 ` Athira Rajeev
2023-07-20 5:18 ` kajoljain
0 siblings, 1 reply; 33+ messages in thread
From: Athira Rajeev @ 2023-07-20 5:12 UTC (permalink / raw)
To: Ian Rogers
Cc: kajoljain, Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim,
linux-perf-users, linuxppc-dev, Madhavan Srinivasan, disgoel
> On 19-Jul-2023, at 11:16 PM, Ian Rogers <irogers@google.com> wrote:
>
> On Tue, Jul 18, 2023 at 11:17 PM kajoljain <kjain@linux.ibm.com> wrote:
>>
>> Hi,
>>
>> Looking for review comments on this patchset.
>>
>> Thanks,
>> Kajol Jain
>>
>>
>> On 7/9/23 23:57, Athira Rajeev 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.
>>>
>>> The shellcheck is run for severity level for errors and warnings.
>>> Command used:
>>>
>>> # for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
>>> # echo $?
>>> 0
>>>
>
> I don't see anything objectionable in the changes so for the series:
> Acked-by: Ian Rogers <irogers@google.com>
>
> Some thoughts:
> - Adding "#!/bin/bash" to scripts in tools/perf/tests/lib - I think
> we didn't do this to avoid these being included as tests. There are
> now extra checks when finding shell tests, so I can imagine doing this
> isn't a regression but just a heads up.
> - I think James' comment was addressed:
> https://lore.kernel.org/linux-perf-users/334989bf-5501-494c-f246-81878fd2fed8@arm.com/
> - Why aren't these changes being mailed to LKML? The wider community
> on LKML have thoughts on shell scripts, plus it makes the changes miss
> my mail filters.
> - Can we automate this testing into the build? For example, following
> a similar kernel build pattern we run a python test and make the log
> output a requirement here:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n30
> I think we can translate:
> for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck
> -S warning $F; done
> into a rule in make for log files that are then a dependency on the
> perf binary. We can then parallel shellcheck during the build and
> avoid regressions. We probably need a CONFIG_SHELLCHECK feature check
> in the build to avoid not having shellcheck breaking the build.
Hi Ian
Thanks for the comments.
Yes, next step after this is to include build option for shellcheck by updating Makefile.
We will surely get into that build option enablement patch once we have all these corrections in place.
Thanks
Athira
>
> Thanks,
> Ian
>
>>> Changelog:
>>> v1 -> v2:
>>> - Rebased on top of perf-tools-next from:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
>>>
>>> - Fixed shellcheck errors and warnings reported for newly
>>> added changes from perf-tools-next branch
>>>
>>> - Addressed review comment from James clark for patch
>>> number 13 from V1. The changes in patch 13 were not necessary
>>> since the file "tests/shell/lib/coresight.sh" is sourced from
>>> other test files.
>>>
>>> Akanksha J N (1):
>>> tools/perf/tests: Fix shellcheck warnings for
>>> trace+probe_vfs_getname.sh
>>>
>>> Athira Rajeev (14):
>>> 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 warnings 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
>>> tools/perf/tests/shell: Fix the shellcheck warnings in
>>> record+zstd_comp_decomp.sh
>>> tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
>>> testcase
>>> tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
>>> testcase
>>>
>>> Kajol Jain (11):
>>> 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 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
>>> tools/shell/coresight: Fix shellcheck warning for
>>> thread_loop_check_tid_2.sh shell script
>>> tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
>>> shell 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 +-
>>> .../coresight/thread_loop_check_tid_2.sh | 2 +-
>>> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
>>> tools/perf/tests/shell/lib/probe.sh | 1 +
>>> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
>>> tools/perf/tests/shell/lib/stat_output.sh | 1 +
>>> 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 +--
>>> .../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
>>> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
>>> tools/perf/tests/shell/stat+csv_output.sh | 2 +-
>>> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
>>> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
>>> tools/perf/tests/shell/stat+std_output.sh | 3 +-
>>> 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 ++--
>>> 26 files changed, 67 insertions(+), 71 deletions(-)
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-07-20 5:12 ` Athira Rajeev
@ 2023-07-20 5:18 ` kajoljain
2023-07-25 5:50 ` Athira Rajeev
0 siblings, 1 reply; 33+ messages in thread
From: kajoljain @ 2023-07-20 5:18 UTC (permalink / raw)
To: Athira Rajeev, Ian Rogers
Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim,
linux-perf-users, linuxppc-dev, Madhavan Srinivasan, disgoel
On 7/20/23 10:42, Athira Rajeev wrote:
>
>
>> On 19-Jul-2023, at 11:16 PM, Ian Rogers <irogers@google.com> wrote:
>>
>> On Tue, Jul 18, 2023 at 11:17 PM kajoljain <kjain@linux.ibm.com> wrote:
>>>
>>> Hi,
>>>
>>> Looking for review comments on this patchset.
>>>
>>> Thanks,
>>> Kajol Jain
>>>
>>>
>>> On 7/9/23 23:57, Athira Rajeev 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.
>>>>
>>>> The shellcheck is run for severity level for errors and warnings.
>>>> Command used:
>>>>
>>>> # for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
>>>> # echo $?
>>>> 0
>>>>
>>
>> I don't see anything objectionable in the changes so for the series:
>> Acked-by: Ian Rogers <irogers@google.com>
>>
>> Some thoughts:
>> - Adding "#!/bin/bash" to scripts in tools/perf/tests/lib - I think
>> we didn't do this to avoid these being included as tests. There are
>> now extra checks when finding shell tests, so I can imagine doing this
>> isn't a regression but just a heads up.
>> - I think James' comment was addressed:
>> https://lore.kernel.org/linux-perf-users/334989bf-5501-494c-f246-81878fd2fed8@arm.com/
>> - Why aren't these changes being mailed to LKML? The wider community
>> on LKML have thoughts on shell scripts, plus it makes the changes miss
>> my mail filters.
>> - Can we automate this testing into the build? For example, following
>> a similar kernel build pattern we run a python test and make the log
>> output a requirement here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n30
>> I think we can translate:
>> for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck
>> -S warning $F; done
>> into a rule in make for log files that are then a dependency on the
>> perf binary. We can then parallel shellcheck during the build and
>> avoid regressions. We probably need a CONFIG_SHELLCHECK feature check
>> in the build to avoid not having shellcheck breaking the build.
>
> Hi Ian
>
> Thanks for the comments.
> Yes, next step after this is to include build option for shellcheck by updating Makefile.
> We will surely get into that build option enablement patch once we have all these corrections in place.
>
> Thanks
> Athira
>>
Hi Ian,
Thanks for reviewing the patches. As athira mentioned our next is to
include build option. So, we will work on it next once all the
correction done.
Thanks,
Kajol Jain
>> Thanks,
>> Ian
>>
>>>> Changelog:
>>>> v1 -> v2:
>>>> - Rebased on top of perf-tools-next from:
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
>>>>
>>>> - Fixed shellcheck errors and warnings reported for newly
>>>> added changes from perf-tools-next branch
>>>>
>>>> - Addressed review comment from James clark for patch
>>>> number 13 from V1. The changes in patch 13 were not necessary
>>>> since the file "tests/shell/lib/coresight.sh" is sourced from
>>>> other test files.
>>>>
>>>> Akanksha J N (1):
>>>> tools/perf/tests: Fix shellcheck warnings for
>>>> trace+probe_vfs_getname.sh
>>>>
>>>> Athira Rajeev (14):
>>>> 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 warnings 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
>>>> tools/perf/tests/shell: Fix the shellcheck warnings in
>>>> record+zstd_comp_decomp.sh
>>>> tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
>>>> testcase
>>>> tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
>>>> testcase
>>>>
>>>> Kajol Jain (11):
>>>> 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 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
>>>> tools/shell/coresight: Fix shellcheck warning for
>>>> thread_loop_check_tid_2.sh shell script
>>>> tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
>>>> shell 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 +-
>>>> .../coresight/thread_loop_check_tid_2.sh | 2 +-
>>>> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
>>>> tools/perf/tests/shell/lib/probe.sh | 1 +
>>>> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
>>>> tools/perf/tests/shell/lib/stat_output.sh | 1 +
>>>> 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 +--
>>>> .../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
>>>> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
>>>> tools/perf/tests/shell/stat+csv_output.sh | 2 +-
>>>> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
>>>> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
>>>> tools/perf/tests/shell/stat+std_output.sh | 3 +-
>>>> 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 ++--
>>>> 26 files changed, 67 insertions(+), 71 deletions(-)
>
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-07-20 5:18 ` kajoljain
@ 2023-07-25 5:50 ` Athira Rajeev
2023-07-28 19:04 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 33+ messages in thread
From: Athira Rajeev @ 2023-07-25 5:50 UTC (permalink / raw)
To: kajoljain, Namhyung Kim, Arnaldo Carvalho de Melo
Cc: Ian Rogers, Jiri Olsa, linux-perf-users, linuxppc-dev,
Madhavan Srinivasan, Disha Goel
> On 20-Jul-2023, at 10:48 AM, kajoljain <kjain@linux.ibm.com> wrote:
>
>
>
> On 7/20/23 10:42, Athira Rajeev wrote:
>>
>>
>>> On 19-Jul-2023, at 11:16 PM, Ian Rogers <irogers@google.com> wrote:
>>>
>>> On Tue, Jul 18, 2023 at 11:17 PM kajoljain <kjain@linux.ibm.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Looking for review comments on this patchset.
>>>>
>>>> Thanks,
>>>> Kajol Jain
>>>>
>>>>
>>>> On 7/9/23 23:57, Athira Rajeev 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.
>>>>>
>>>>> The shellcheck is run for severity level for errors and warnings.
>>>>> Command used:
>>>>>
>>>>> # for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
>>>>> # echo $?
>>>>> 0
>>>>>
>>>
>>> I don't see anything objectionable in the changes so for the series:
>>> Acked-by: Ian Rogers <irogers@google.com>
>>>
>>> Some thoughts:
>>> - Adding "#!/bin/bash" to scripts in tools/perf/tests/lib - I think
>>> we didn't do this to avoid these being included as tests. There are
>>> now extra checks when finding shell tests, so I can imagine doing this
>>> isn't a regression but just a heads up.
>>> - I think James' comment was addressed:
>>> https://lore.kernel.org/linux-perf-users/334989bf-5501-494c-f246-81878fd2fed8@arm.com/
>>> - Why aren't these changes being mailed to LKML? The wider community
>>> on LKML have thoughts on shell scripts, plus it makes the changes miss
>>> my mail filters.
>>> - Can we automate this testing into the build? For example, following
>>> a similar kernel build pattern we run a python test and make the log
>>> output a requirement here:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n30
>>> I think we can translate:
>>> for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck
>>> -S warning $F; done
>>> into a rule in make for log files that are then a dependency on the
>>> perf binary. We can then parallel shellcheck during the build and
>>> avoid regressions. We probably need a CONFIG_SHELLCHECK feature check
>>> in the build to avoid not having shellcheck breaking the build.
>>
>> Hi Ian
>>
>> Thanks for the comments.
>> Yes, next step after this is to include build option for shellcheck by updating Makefile.
>> We will surely get into that build option enablement patch once we have all these corrections in place.
>>
>> Thanks
>> Athira
>>>
>
> Hi Ian,
> Thanks for reviewing the patches. As athira mentioned our next is to
> include build option. So, we will work on it next once all the
> correction done.
>
> Thanks,
> Kajol Jain
Hi Arnaldo, Namhyung
Can you have this patchset applied along with Acked-by from Ian ?
Our next step is to add a build option for shellcheck by updating Makefile and will be working on that.
Thanks
Athira
>
>>> Thanks,
>>> Ian
>>>
>>>>> Changelog:
>>>>> v1 -> v2:
>>>>> - Rebased on top of perf-tools-next from:
>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
>>>>>
>>>>> - Fixed shellcheck errors and warnings reported for newly
>>>>> added changes from perf-tools-next branch
>>>>>
>>>>> - Addressed review comment from James clark for patch
>>>>> number 13 from V1. The changes in patch 13 were not necessary
>>>>> since the file "tests/shell/lib/coresight.sh" is sourced from
>>>>> other test files.
>>>>>
>>>>> Akanksha J N (1):
>>>>> tools/perf/tests: Fix shellcheck warnings for
>>>>> trace+probe_vfs_getname.sh
>>>>>
>>>>> Athira Rajeev (14):
>>>>> 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 warnings 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
>>>>> tools/perf/tests/shell: Fix the shellcheck warnings in
>>>>> record+zstd_comp_decomp.sh
>>>>> tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
>>>>> testcase
>>>>> tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
>>>>> testcase
>>>>>
>>>>> Kajol Jain (11):
>>>>> 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 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
>>>>> tools/shell/coresight: Fix shellcheck warning for
>>>>> thread_loop_check_tid_2.sh shell script
>>>>> tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
>>>>> shell 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 +-
>>>>> .../coresight/thread_loop_check_tid_2.sh | 2 +-
>>>>> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
>>>>> tools/perf/tests/shell/lib/probe.sh | 1 +
>>>>> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
>>>>> tools/perf/tests/shell/lib/stat_output.sh | 1 +
>>>>> 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 +--
>>>>> .../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
>>>>> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
>>>>> tools/perf/tests/shell/stat+csv_output.sh | 2 +-
>>>>> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
>>>>> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
>>>>> tools/perf/tests/shell/stat+std_output.sh | 3 +-
>>>>> 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 ++--
>>>>> 26 files changed, 67 insertions(+), 71 deletions(-)
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
2023-07-25 5:50 ` Athira Rajeev
@ 2023-07-28 19:04 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 33+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-07-28 19:04 UTC (permalink / raw)
To: Athira Rajeev
Cc: kajoljain, Namhyung Kim, Ian Rogers, Jiri Olsa, linux-perf-users,
linuxppc-dev, Madhavan Srinivasan, Disha Goel
Em Tue, Jul 25, 2023 at 11:20:37AM +0530, Athira Rajeev escreveu:
>
>
> > On 20-Jul-2023, at 10:48 AM, kajoljain <kjain@linux.ibm.com> wrote:
> >
> >
> >
> > On 7/20/23 10:42, Athira Rajeev wrote:
> >>
> >>
> >>> On 19-Jul-2023, at 11:16 PM, Ian Rogers <irogers@google.com> wrote:
> >>>
> >>> On Tue, Jul 18, 2023 at 11:17 PM kajoljain <kjain@linux.ibm.com> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> Looking for review comments on this patchset.
> >>>>
> >>>> Thanks,
> >>>> Kajol Jain
> >>>>
> >>>>
> >>>> On 7/9/23 23:57, Athira Rajeev 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.
> >>>>>
> >>>>> The shellcheck is run for severity level for errors and warnings.
> >>>>> Command used:
> >>>>>
> >>>>> # for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck -S warning $F; done
> >>>>> # echo $?
> >>>>> 0
> >>>>>
> >>>
> >>> I don't see anything objectionable in the changes so for the series:
> >>> Acked-by: Ian Rogers <irogers@google.com>
> >>>
> >>> Some thoughts:
> >>> - Adding "#!/bin/bash" to scripts in tools/perf/tests/lib - I think
> >>> we didn't do this to avoid these being included as tests. There are
> >>> now extra checks when finding shell tests, so I can imagine doing this
> >>> isn't a regression but just a heads up.
> >>> - I think James' comment was addressed:
> >>> https://lore.kernel.org/linux-perf-users/334989bf-5501-494c-f246-81878fd2fed8@arm.com/
> >>> - Why aren't these changes being mailed to LKML? The wider community
> >>> on LKML have thoughts on shell scripts, plus it makes the changes miss
> >>> my mail filters.
> >>> - Can we automate this testing into the build? For example, following
> >>> a similar kernel build pattern we run a python test and make the log
> >>> output a requirement here:
> >>> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n30
> >>> I think we can translate:
> >>> for F in $(find tests/shell/ -perm -o=x -name '*.sh'); do shellcheck
> >>> -S warning $F; done
> >>> into a rule in make for log files that are then a dependency on the
> >>> perf binary. We can then parallel shellcheck during the build and
> >>> avoid regressions. We probably need a CONFIG_SHELLCHECK feature check
> >>> in the build to avoid not having shellcheck breaking the build.
> >>
> >> Hi Ian
> >>
> >> Thanks for the comments.
> >> Yes, next step after this is to include build option for shellcheck by updating Makefile.
> >> We will surely get into that build option enablement patch once we have all these corrections in place.
> >>
> >> Thanks
> >> Athira
> >>>
> >
> > Hi Ian,
> > Thanks for reviewing the patches. As athira mentioned our next is to
> > include build option. So, we will work on it next once all the
> > correction done.
> >
> > Thanks,
> > Kajol Jain
>
> Hi Arnaldo, Namhyung
>
> Can you have this patchset applied along with Acked-by from Ian ?
> Our next step is to add a build option for shellcheck by updating Makefile and will be working on that.
I'll check it now
> Thanks
> Athira
> >
> >>> Thanks,
> >>> Ian
> >>>
> >>>>> Changelog:
> >>>>> v1 -> v2:
> >>>>> - Rebased on top of perf-tools-next from:
> >>>>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf-tools-next
> >>>>>
> >>>>> - Fixed shellcheck errors and warnings reported for newly
> >>>>> added changes from perf-tools-next branch
> >>>>>
> >>>>> - Addressed review comment from James clark for patch
> >>>>> number 13 from V1. The changes in patch 13 were not necessary
> >>>>> since the file "tests/shell/lib/coresight.sh" is sourced from
> >>>>> other test files.
> >>>>>
> >>>>> Akanksha J N (1):
> >>>>> tools/perf/tests: Fix shellcheck warnings for
> >>>>> trace+probe_vfs_getname.sh
> >>>>>
> >>>>> Athira Rajeev (14):
> >>>>> 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 warnings 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
> >>>>> tools/perf/tests/shell: Fix the shellcheck warnings in
> >>>>> record+zstd_comp_decomp.sh
> >>>>> tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh
> >>>>> testcase
> >>>>> tools/perf/tests: Fix shellcheck warning for stat+std_output.sh
> >>>>> testcase
> >>>>>
> >>>>> Kajol Jain (11):
> >>>>> 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 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
> >>>>> tools/shell/coresight: Fix shellcheck warning for
> >>>>> thread_loop_check_tid_2.sh shell script
> >>>>> tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh
> >>>>> shell 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 +-
> >>>>> .../coresight/thread_loop_check_tid_2.sh | 2 +-
> >>>>> .../shell/coresight/unroll_loop_thread_10.sh | 2 +-
> >>>>> tools/perf/tests/shell/lib/probe.sh | 1 +
> >>>>> .../perf/tests/shell/lib/probe_vfs_getname.sh | 5 ++--
> >>>>> tools/perf/tests/shell/lib/stat_output.sh | 1 +
> >>>>> 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 +--
> >>>>> .../tests/shell/record+zstd_comp_decomp.sh | 14 +++++-----
> >>>>> tools/perf/tests/shell/record_offcpu.sh | 6 ++--
> >>>>> tools/perf/tests/shell/stat+csv_output.sh | 2 +-
> >>>>> tools/perf/tests/shell/stat+csv_summary.sh | 4 +--
> >>>>> tools/perf/tests/shell/stat+shadow_stat.sh | 4 +--
> >>>>> tools/perf/tests/shell/stat+std_output.sh | 3 +-
> >>>>> 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 ++--
> >>>>> 26 files changed, 67 insertions(+), 71 deletions(-)
>
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2023-07-28 19:04 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09 18:27 [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 01/26] tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 02/26] tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 03/26] tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 04/26] tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 05/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 06/26] tools/perf/tests: fix test_arm_spe_fork.sh signal case issues Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 07/26] tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 08/26] tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 09/26] tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 10/26] tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 11/26] tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 12/26] tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh " Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 13/26] tools/perf/tests: Fix shellcheck warning for probe.sh " Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 14/26] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 15/26] tools/perf: Fix shellcheck issue for check-headers.sh script Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 16/26] tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 17/26] tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 18/26] tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 19/26] tools/perf/tests: Fix the shellcheck warnings in lib/waiting.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 20/26] tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 21/26] tools/perf/arch/x86: Fix syscalltbl.sh " Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 22/26] tools/perf/tests/shell: Fix the shellcheck warnings in record+zstd_comp_decomp.sh Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 23/26] tools/shell/coresight: Fix shellcheck warning for thread_loop_check_tid_2.sh shell script Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 24/26] tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh " Athira Rajeev
2023-07-09 18:27 ` [PATCH V2 25/26] tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh testcase Athira Rajeev
2023-07-09 18:28 ` [PATCH V2 26/26] tools/perf/tests: " Athira Rajeev
2023-07-19 6:17 ` [PATCH V2 00/26] tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts kajoljain
2023-07-19 17:46 ` Ian Rogers
2023-07-20 5:12 ` Athira Rajeev
2023-07-20 5:18 ` kajoljain
2023-07-25 5:50 ` Athira Rajeev
2023-07-28 19:04 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).