tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
Subsystems (3)
v2 cover tools/perf: Fix shellcheck coding/formatting issues of perf tool shell scripts
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/[email protected]/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(-)
Signature · 1 line
2.39.1
PATCH v2 1/26 tools/perf/tests: Fix shellcheck warnings for trace+probe_vfs_getname.sh
From: Akanksha J N <[email protected]>
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.
--- tools/perf/tests/shell/trace+probe_vfs_getname.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/tests/shell/trace+probe_vfs_getname.sh +3 -3
@@ -10,15 +10,15 @@ # SPDX-License-Identifier: GPL-2.0 # Arnaldo Carvalho de Melo <[email protected]>, 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]+$" }
Signature · 1 line
2.39.1
PATCH v2 2/26 tools/perf/tests: Fix shellcheck warning for probe_vfs_getname.sh testcase
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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
#--- tools/perf/tests/shell/probe_vfs_getname.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/probe_vfs_getname.sh +2 -2
@@ -4,11 +4,11 @@ # SPDX-License-Identifier: GPL-2.0 # Arnaldo Carvalho de Melo <[email protected]>, 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=$?
Signature · 1 line
2.39.1
PATCH v2 3/26 tools/perf/tests: Fix shellcheck warning for record_offcpu.sh testcase
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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
$--- tools/perf/tests/shell/record_offcpu.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/tests/shell/record_offcpu.sh +3 -3
@@ -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
Signature · 1 line
2.39.1
PATCH v2 4/26 tools/perf/tests: Fix shellcheck issue for lock_contention.sh testcase
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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.
--- tools/perf/tests/shell/lock_contention.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/perf/tests/shell/lock_contention.sh +6 -6
@@ -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
Signature · 1 line
2.39.1
PATCH v2 5/26 tools/perf/tests: Fix shellcheck issue for stat_bpf_counters_cgrp.sh testcase
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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.
--- .../tests/shell/stat_bpf_counters_cgrp.sh | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-)
tools/perf/tests/shell/stat_bpf_counters_cgrp.sh +12 -16
@@ -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
Signature · 1 line
2.39.1
PATCH v2 6/26 tools/perf/tests: fix test_arm_spe_fork.sh signal case issues
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/test_arm_spe_fork.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/test_arm_spe_fork.sh +1 -1
@@ -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 &
Signature · 1 line
2.39.1
PATCH v2 7/26 tools/perf/tests: Fix unused variable references in stat+csv_summary.sh testcase
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/stat+csv_summary.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+csv_summary.sh +2 -2
@@ -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
Signature · 1 line
2.39.1
PATCH v2 8/26 tools/perf/tests: fix shellcheck warning for test_perf_data_converter_json.sh testcase
In reply to Athira RajeevRunning 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
#--- tools/perf/tests/shell/test_perf_data_converter_json.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/test_perf_data_converter_json.sh +1 -1
@@ -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]"
Signature · 1 line
2.39.1
PATCH v2 9/26 tools/perf/tests: Fix shellcheck issue for stat_bpf_counters.sh testcase
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/stat_bpf_counters.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat_bpf_counters.sh +2 -2
@@ -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
Signature · 1 line
2.39.1
PATCH v2 10/26 tools/perf/tests: Fix shellcheck issues in tests/shell/stat+shadow_stat.sh tetscase
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/stat+shadow_stat.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+shadow_stat.sh +2 -2
@@ -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
Signature · 1 line
2.39.1
PATCH v2 11/26 tools/perf/tests: Fix shellcheck warning for asm_pure_loop.sh shell script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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
#--- tools/perf/tests/shell/coresight/asm_pure_loop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/coresight/asm_pure_loop.sh +1 -1
@@ -5,7 +5,7 @@ # Carsten Haitzler <[email protected]>, 2021 TEST="asm_pure_loop" -. $(dirname $0)/../lib/coresight.sh +. "$(dirname $0)"/../lib/coresight.sh ARGS="" DATV="out" DATA="$DATD/perf-$TEST-$DATV.data"
Signature · 1 line
2.39.1
PATCH v2 12/26 tools/perf/tests: Fix shellcheck warning for memcpy_thread_16k_10.sh shell script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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
#--- tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh +1 -1
@@ -5,7 +5,7 @@ # Carsten Haitzler <[email protected]>, 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"
Signature · 1 line
2.39.1
PATCH v2 13/26 tools/perf/tests: Fix shellcheck warning for probe.sh shell script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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.
--- tools/perf/tests/shell/lib/probe.sh | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/shell/lib/probe.sh +1 -0
@@ -1,3 +1,4 @@ +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # Arnaldo Carvalho de Melo <[email protected]>, 2017
Signature · 1 line
2.39.1
PATCH v2 14/26 tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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
--- tools/perf/trace/beauty/arch_errno_names.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
tools/perf/trace/beauty/arch_errno_names.sh +6 -9
@@ -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'
Signature · 1 line
2.39.1
PATCH v2 15/26 tools/perf: Fix shellcheck issue for check-headers.sh script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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
--- tools/perf/check-headers.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/check-headers.sh +3 -3
@@ -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
Signature · 1 line
2.39.1
PATCH v2 16/26 tools/perf/tests: Fix shellcheck warnings for thread_loop_check_tid_10.sh
In reply to Athira RajeevFix 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.
--- tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh +1 -1
@@ -5,7 +5,7 @@ # Carsten Haitzler <[email protected]>, 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"
Signature · 1 line
2.39.1
PATCH v2 17/26 tools/perf/tests: Fix shellcheck warnings for unroll_loop_thread_10.sh
In reply to Athira RajeevFix the shellcheck warnings for unroll_loop_thread_10.sh Add quotes to prevent word splitting which are caused by unquoted command expansions.
--- tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh +1 -1
@@ -5,7 +5,7 @@ # Carsten Haitzler <[email protected]>, 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"
Signature · 1 line
2.39.1
PATCH v2 18/26 tools/perf/tests: Fix shellcheck warnings for lib/probe_vfs_getname.sh
In reply to Athira RajeevRunning 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 <[email protected]>, 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
--- tools/perf/tests/shell/lib/probe_vfs_getname.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/tests/shell/lib/probe_vfs_getname.sh +3 -2
@@ -1,3 +1,4 @@ +#!/bin/sh # Arnaldo Carvalho de Melo <[email protected]>, 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 }
Signature · 1 line
2.39.1
PATCH v2 19/26 tools/perf/tests: Fix the shellcheck warnings in lib/waiting.sh
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/lib/waiting.sh | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/shell/lib/waiting.sh +1 -0
@@ -1,3 +1,4 @@ +#!/bin/sh # SPDX-License-Identifier: GPL-2.0 tenths=date\ +%s%1N
Signature · 1 line
2.39.1
PATCH v2 20/26 tools/perf/trace: Fix x86_arch_prctl.sh to address shellcheck warnings
In reply to Athira RajeevRunning 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
--- tools/perf/trace/beauty/x86_arch_prctl.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/trace/beauty/x86_arch_prctl.sh +3 -3
@@ -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
Signature · 1 line
2.39.1
PATCH v2 21/26 tools/perf/arch/x86: Fix syscalltbl.sh to address shellcheck warnings
In reply to Athira RajeevRunning 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.
--- tools/perf/arch/x86/entry/syscalls/syscalltbl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/entry/syscalls/syscalltbl.sh +1 -1
@@ -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
Signature · 1 line
2.39.1
PATCH v2 22/26 tools/perf/tests/shell: Fix the shellcheck warnings in record+zstd_comp_decomp.sh
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/record+zstd_comp_decomp.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/perf/tests/shell/record+zstd_comp_decomp.sh +7 -7
@@ -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
Signature · 1 line
2.39.1
PATCH v2 23/26 tools/shell/coresight: Fix shellcheck warning for thread_loop_check_tid_2.sh shell script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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.
--- tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh +1 -1
@@ -5,7 +5,7 @@ # Carsten Haitzler <[email protected]>, 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"
Signature · 1 line
2.39.1
PATCH v2 24/26 tools/perf/tests/shell/lib: Fix shellcheck warning for stat_output.sh shell script
In reply to Athira RajeevFrom: Kajol Jain <[email protected]>
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.
--- tools/perf/tests/shell/lib/stat_output.sh | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/shell/lib/stat_output.sh +1 -0
@@ -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.
Signature · 1 line
2.39.1
PATCH v2 25/26 tools/perf/tests/shell: Fix shellcheck warning for stat+std_output.sh testcase
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/stat+csv_output.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/stat+csv_output.sh +1 -1
@@ -6,7 +6,7 @@ set -e -. $(dirname $0)/lib/stat_output.sh +. "$(dirname $0)"/lib/stat_output.sh csv_sep=@
Signature · 1 line
2.39.1
PATCH v2 26/26 tools/perf/tests: Fix shellcheck warning for stat+std_output.sh testcase
In reply to Athira RajeevRunning 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.
--- tools/perf/tests/shell/stat+std_output.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/tests/shell/stat+std_output.sh +1 -2
@@ -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"
Signature · 1 line
2.39.1
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol Jain
Quoted 108 lines · Athira Rajeev
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/[email protected]/T/#tThis 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 fromtools/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 $? 0Changelog:
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.shAthira Rajeev (14):
tools/perf/tests: fixtest_arm_spe_fork.shsignal case issuestools/perf/tests: Fix unused variable references in
stat+csv_summary.shtestcase
tools/perf/tests: fix shellcheck warning for
test_perf_data_converter_json.shtestcase
tools/perf/tests: Fix shellcheck issue forstat_bpf_counters.sh
testcase
tools/perf/tests: Fix shellcheck issues in
tests/shell/stat+shadow_stat.shtetscase
tools/perf/tests: Fix shellcheck warnings forthread_loop_check_tid_10.sh
tools/perf/tests: Fix shellcheck warnings forunroll_loop_thread_10.shtools/perf/tests: Fix shellcheck warnings forlib/probe_vfs_getname.shtools/perf/tests: Fix the shellcheck warnings inlib/waiting.shtools/perf/trace: Fixx86_arch_prctl.shto address shellcheck warningstools/perf/arch/x86: Fixsyscalltbl.shto address shellcheck warningstools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.sh
tools/perf/tests/shell: Fix shellcheck warning forstat+std_output.sh
testcase
tools/perf/tests: Fix shellcheck warning forstat+std_output.sh
testcaseKajol Jain (11):
tools/perf/tests: Fix shellcheck warning forprobe_vfs_getname.sh
testcase
tools/perf/tests: Fix shellcheck warning forrecord_offcpu.shtestcasetools/perf/tests: Fix shellcheck issue forlock_contention.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters_cgrp.sh
testcase
tools/perf/tests: Fix shellcheck warning forasm_pure_loop.shshell
script
tools/perf/tests: Fix shellcheck warning formemcpy_thread_16k_10.sh
shell script
tools/perf/tests: Fix shellcheck warning forprobe.shshell scripttools/perf/trace: Fix shellcheck issue forarch_errno_names.shscripttools/perf: Fix shellcheck issue forcheck-headers.shscripttools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.shshell script
tools/perf/tests/shell/lib: Fix shellcheck warning forstat_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(-)
Quoted 30 lines · kajoljain
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol JainQuoted 20 lines · Athira Rajeev
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/[email protected]/T/#tThis 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 fromtools/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:
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/[email protected]/
- 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
Quoted 88 lines
Quoted 88 lines
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.shAthira Rajeev (14):
tools/perf/tests: fixtest_arm_spe_fork.shsignal case issuestools/perf/tests: Fix unused variable references in
stat+csv_summary.shtestcase
tools/perf/tests: fix shellcheck warning for
test_perf_data_converter_json.shtestcase
tools/perf/tests: Fix shellcheck issue forstat_bpf_counters.sh
testcase
tools/perf/tests: Fix shellcheck issues in
tests/shell/stat+shadow_stat.shtetscase
tools/perf/tests: Fix shellcheck warnings forthread_loop_check_tid_10.sh
tools/perf/tests: Fix shellcheck warnings forunroll_loop_thread_10.shtools/perf/tests: Fix shellcheck warnings forlib/probe_vfs_getname.shtools/perf/tests: Fix the shellcheck warnings inlib/waiting.shtools/perf/trace: Fixx86_arch_prctl.shto address shellcheck warningstools/perf/arch/x86: Fixsyscalltbl.shto address shellcheck warningstools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.sh
tools/perf/tests/shell: Fix shellcheck warning forstat+std_output.sh
testcase
tools/perf/tests: Fix shellcheck warning forstat+std_output.sh
testcaseKajol Jain (11):
tools/perf/tests: Fix shellcheck warning forprobe_vfs_getname.sh
testcase
tools/perf/tests: Fix shellcheck warning forrecord_offcpu.shtestcasetools/perf/tests: Fix shellcheck issue forlock_contention.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters_cgrp.sh
testcase
tools/perf/tests: Fix shellcheck warning forasm_pure_loop.shshell
script
tools/perf/tests: Fix shellcheck warning formemcpy_thread_16k_10.sh
shell script
tools/perf/tests: Fix shellcheck warning forprobe.shshell scripttools/perf/trace: Fix shellcheck issue forarch_errno_names.shscripttools/perf: Fix shellcheck issue forcheck-headers.shscripttools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.shshell script
tools/perf/tests/shell/lib: Fix shellcheck warning forstat_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(-)
Quoted 52 lines · Ian Rogers
Quoted 30 lines · kajoljain
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol JainQuoted 20 lines · Athira Rajeev
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/[email protected]/T/#tThis 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 fromtools/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 $? 0I don't see anything objectionable in the changes so for the series:
Acked-by Ian Rogers <[email protected]>Some thoughts:
- Adding "#!/bin/bash" to scripts intools/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/[email protected]/
- 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:
Quoted 8 lines
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 aCONFIG_SHELLCHECKfeature 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
Quoted 91 lines
Thanks,
IanQuoted 87 lines
Quoted 87 lines
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.shAthira Rajeev (14):
tools/perf/tests: fixtest_arm_spe_fork.shsignal case issuestools/perf/tests: Fix unused variable references in
stat+csv_summary.shtestcase
tools/perf/tests: fix shellcheck warning for
test_perf_data_converter_json.shtestcase
tools/perf/tests: Fix shellcheck issue forstat_bpf_counters.sh
testcase
tools/perf/tests: Fix shellcheck issues in
tests/shell/stat+shadow_stat.shtetscase
tools/perf/tests: Fix shellcheck warnings for
thread_loop_check_tid_10.sh
tools/perf/tests: Fix shellcheck warnings forunroll_loop_thread_10.shtools/perf/tests: Fix shellcheck warnings forlib/probe_vfs_getname.shtools/perf/tests: Fix the shellcheck warnings inlib/waiting.shtools/perf/trace: Fixx86_arch_prctl.shto address shellcheck warningstools/perf/arch/x86: Fixsyscalltbl.shto address shellcheck warningstools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.sh
tools/perf/tests/shell: Fix shellcheck warning forstat+std_output.sh
testcase
tools/perf/tests: Fix shellcheck warning forstat+std_output.sh
testcaseKajol Jain (11):
tools/perf/tests: Fix shellcheck warning forprobe_vfs_getname.sh
testcase
tools/perf/tests: Fix shellcheck warning forrecord_offcpu.shtestcasetools/perf/tests: Fix shellcheck issue forlock_contention.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters_cgrp.sh
testcase
tools/perf/tests: Fix shellcheck warning forasm_pure_loop.shshell
script
tools/perf/tests: Fix shellcheck warning formemcpy_thread_16k_10.sh
shell script
tools/perf/tests: Fix shellcheck warning forprobe.shshell scripttools/perf/trace: Fix shellcheck issue forarch_errno_names.shscripttools/perf: Fix shellcheck issue forcheck-headers.shscripttools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.shshell script
tools/perf/tests/shell/lib: Fix shellcheck warning forstat_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(-)
Quoted 61 lines · Athira Rajeev
Quoted 52 lines · Ian Rogers
Quoted 30 lines · kajoljain
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol JainQuoted 20 lines · Athira Rajeev
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/[email protected]/T/#tThis 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 fromtools/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 $? 0I don't see anything objectionable in the changes so for the series:
Acked-by Ian Rogers <[email protected]>Some thoughts:
- Adding "#!/bin/bash" to scripts intools/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/[email protected]/
- 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:Quoted 8 lines
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 aCONFIG_SHELLCHECKfeature check in the build to avoid not having shellcheck breaking the build.
Quoted 9 lines
Hi Ian
Thanks for the comments.
Yes, next step after this is to include build option for shellcheck by updatingMakefile. We will surely get into that build option enablement patch once we have all these corrections in place.Thanks
AthiraQuoted 1 line
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
Quoted 92 lines
Quoted 90 lines
Thanks,
IanQuoted 87 lines
Quoted 87 lines
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.shAthira Rajeev (14):
tools/perf/tests: fixtest_arm_spe_fork.shsignal case issuestools/perf/tests: Fix unused variable references in
stat+csv_summary.shtestcase
tools/perf/tests: fix shellcheck warning for
test_perf_data_converter_json.shtestcase
tools/perf/tests: Fix shellcheck issue forstat_bpf_counters.sh
testcase
tools/perf/tests: Fix shellcheck issues in
tests/shell/stat+shadow_stat.shtetscase
tools/perf/tests: Fix shellcheck warnings for
thread_loop_check_tid_10.sh
tools/perf/tests: Fix shellcheck warnings forunroll_loop_thread_10.shtools/perf/tests: Fix shellcheck warnings forlib/probe_vfs_getname.shtools/perf/tests: Fix the shellcheck warnings inlib/waiting.shtools/perf/trace: Fixx86_arch_prctl.shto address shellcheck warningstools/perf/arch/x86: Fixsyscalltbl.shto address shellcheck warningstools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.sh
tools/perf/tests/shell: Fix shellcheck warning forstat+std_output.sh
testcase
tools/perf/tests: Fix shellcheck warning forstat+std_output.sh
testcaseKajol Jain (11):
tools/perf/tests: Fix shellcheck warning forprobe_vfs_getname.sh
testcase
tools/perf/tests: Fix shellcheck warning forrecord_offcpu.shtestcasetools/perf/tests: Fix shellcheck issue forlock_contention.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters_cgrp.sh
testcase
tools/perf/tests: Fix shellcheck warning forasm_pure_loop.shshell
script
tools/perf/tests: Fix shellcheck warning formemcpy_thread_16k_10.sh
shell script
tools/perf/tests: Fix shellcheck warning forprobe.shshell scripttools/perf/trace: Fix shellcheck issue forarch_errno_names.shscripttools/perf: Fix shellcheck issue forcheck-headers.shscripttools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.shshell script
tools/perf/tests/shell/lib: Fix shellcheck warning forstat_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(-)
Quoted 78 lines · kajoljain
Quoted 61 lines · Athira Rajeev
Quoted 52 lines · Ian Rogers
Quoted 30 lines · kajoljain
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol JainQuoted 20 lines · Athira Rajeev
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/[email protected]/T/#tThis 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 fromtools/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 $? 0I don't see anything objectionable in the changes so for the series:
Acked-by Ian Rogers <[email protected]>Some thoughts:
- Adding "#!/bin/bash" to scripts intools/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/[email protected]/
- 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:Quoted 8 lines
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 aCONFIG_SHELLCHECKfeature check in the build to avoid not having shellcheck breaking the build.Quoted 9 lines
Hi Ian
Thanks for the comments.
Yes, next step after this is to include build option for shellcheck by updatingMakefile. We will surely get into that build option enablement patch once we have all these corrections in place.Thanks
AthiraQuoted 1 line
Quoted 7 lines
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
Quoted 91 lines
Quoted 91 lines
Quoted 91 lines
Thanks,
IanQuoted 87 lines
Quoted 87 lines
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.shAthira Rajeev (14):
tools/perf/tests: fixtest_arm_spe_fork.shsignal case issuestools/perf/tests: Fix unused variable references in
stat+csv_summary.shtestcasetools/perf/tests: fix shellcheck warning for
test_perf_data_converter_json.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters.sh
testcasetools/perf/tests: Fix shellcheck issues in
tests/shell/stat+shadow_stat.shtetscasetools/perf/tests: Fix shellcheck warnings for
thread_loop_check_tid_10.shtools/perf/tests: Fix shellcheck warnings forunroll_loop_thread_10.shtools/perf/tests: Fix shellcheck warnings forlib/probe_vfs_getname.shtools/perf/tests: Fix the shellcheck warnings inlib/waiting.shtools/perf/trace: Fixx86_arch_prctl.shto address shellcheck warningstools/perf/arch/x86: Fixsyscalltbl.shto address shellcheck warningstools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.shtools/perf/tests/shell: Fix shellcheck warning forstat+std_output.sh
testcasetools/perf/tests: Fix shellcheck warning forstat+std_output.sh
testcaseKajol Jain (11):
tools/perf/tests: Fix shellcheck warning forprobe_vfs_getname.sh
testcasetools/perf/tests: Fix shellcheck warning forrecord_offcpu.shtestcasetools/perf/tests: Fix shellcheck issue forlock_contention.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters_cgrp.sh
testcasetools/perf/tests: Fix shellcheck warning forasm_pure_loop.shshell
scripttools/perf/tests: Fix shellcheck warning formemcpy_thread_16k_10.sh
shell scripttools/perf/tests: Fix shellcheck warning forprobe.shshell scripttools/perf/trace: Fix shellcheck issue forarch_errno_names.shscripttools/perf: Fix shellcheck issue forcheck-headers.shscripttools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.shshell scripttools/perf/tests/shell/lib: Fix shellcheck warning forstat_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 Carvalho de Melo
maintainerEm Tue, Jul 25, 2023 at 11:20:37AM +0530, Athira Rajeev escreveu:
Quoted 83 lines
Quoted 83 lines · kajoljain
Quoted 61 lines · Athira Rajeev
Quoted 52 lines · Ian Rogers
Quoted 30 lines · kajoljain
Hi,
Looking for review comments on this patchset.
Thanks,
Kajol JainQuoted 20 lines · Athira Rajeev
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/[email protected]/T/#tThis 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 fromtools/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 $? 0I don't see anything objectionable in the changes so for the series:
Acked-by Ian Rogers <[email protected]>Some thoughts:
- Adding "#!/bin/bash" to scripts intools/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/[email protected]/
- 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:Quoted 8 lines
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 aCONFIG_SHELLCHECKfeature check in the build to avoid not having shellcheck breaking the build.Quoted 9 lines
Hi Ian
Thanks for the comments.
Yes, next step after this is to include build option for shellcheck by updatingMakefile. We will surely get into that build option enablement patch once we have all these corrections in place.Thanks
AthiraQuoted 1 line
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.
Quoted 7 lines
Quoted 2 lines
Thanks,
Kajol JainHi 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 updatingMakefileand will be working on that.
I'll check it now
Quoted 95 lines
Thanks
AthiraQuoted 91 lines
Quoted 91 lines
Quoted 91 lines
Thanks,
IanQuoted 87 lines
Quoted 87 lines
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.shAthira Rajeev (14):
tools/perf/tests: fixtest_arm_spe_fork.shsignal case issuestools/perf/tests: Fix unused variable references in
stat+csv_summary.shtestcasetools/perf/tests: fix shellcheck warning for
test_perf_data_converter_json.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters.sh
testcasetools/perf/tests: Fix shellcheck issues in
tests/shell/stat+shadow_stat.shtetscasetools/perf/tests: Fix shellcheck warnings for
thread_loop_check_tid_10.shtools/perf/tests: Fix shellcheck warnings forunroll_loop_thread_10.shtools/perf/tests: Fix shellcheck warnings forlib/probe_vfs_getname.shtools/perf/tests: Fix the shellcheck warnings inlib/waiting.shtools/perf/trace: Fixx86_arch_prctl.shto address shellcheck warningstools/perf/arch/x86: Fixsyscalltbl.shto address shellcheck warningstools/perf/tests/shell: Fix the shellcheck warnings in
record+zstd_comp_decomp.shtools/perf/tests/shell: Fix shellcheck warning forstat+std_output.sh
testcasetools/perf/tests: Fix shellcheck warning forstat+std_output.sh
testcaseKajol Jain (11):
tools/perf/tests: Fix shellcheck warning forprobe_vfs_getname.sh
testcasetools/perf/tests: Fix shellcheck warning forrecord_offcpu.shtestcasetools/perf/tests: Fix shellcheck issue forlock_contention.shtestcasetools/perf/tests: Fix shellcheck issue forstat_bpf_counters_cgrp.sh
testcasetools/perf/tests: Fix shellcheck warning forasm_pure_loop.shshell
scripttools/perf/tests: Fix shellcheck warning formemcpy_thread_16k_10.sh
shell scripttools/perf/tests: Fix shellcheck warning forprobe.shshell scripttools/perf/trace: Fix shellcheck issue forarch_errno_names.shscripttools/perf: Fix shellcheck issue forcheck-headers.shscripttools/shell/coresight: Fix shellcheck warning for
thread_loop_check_tid_2.shshell scripttools/perf/tests/shell/lib: Fix shellcheck warning forstat_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(-)
Signature · 1 line
- Arnaldo