[PATCH 1/3] perf tests test_arm_coresight: Fix the shellcheck warning in latest test_arm_coresight.sh

Athira Rajeev atrajeev at linux.vnet.ibm.com
Tue Nov 7 17:38:25 AEDT 2023



> On 07-Nov-2023, at 3:14 AM, Arnaldo Carvalho de Melo <acme at kernel.org> wrote:
> 
> Em Thu, Oct 05, 2023 at 02:24:15PM +0530, Athira Rajeev escreveu:
>>> On 05-Oct-2023, at 1:50 PM, James Clark <james.clark at arm.com> wrote:
>>> On 29/09/2023 05:11, Athira Rajeev wrote:
>>>> Running shellcheck on tests/shell/test_arm_coresight.sh
>>>> throws below warnings:
>>>> 
>>>> In tests/shell/test_arm_coresight.sh line 15:
>>>> cs_etm_path=$(find  /sys/bus/event_source/devices/cs_etm/ -name cpu* -print -quit)
>>>>                 ^--^ SC2061: Quote the parameter to -name so the shell won't interpret it.
>>>> 
>>>> In tests/shell/test_arm_coresight.sh line 20:
>>>> if [ $archhver -eq 5 -a "$(printf "0x%X\n" $archpart)" = "0xA13" ] ; then
>>>>                             ^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined
>>>> 
>>>> This warning is observed after commit:
>>>> "commit bb350847965d ("perf test: Update cs_etm testcase for Arm ETE")"
>>>> 
>>>> Fixed this issue by using quoting 'cpu*' for SC2061 and
>>>> using "&&" in line number 20 for SC2166 warning
>>>> 
>>>> Fixes: bb350847965d ("perf test: Update cs_etm testcase for Arm ETE")
>>>> Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
>>>> ---
>>>> tools/perf/tests/shell/test_arm_coresight.sh | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>> 
>>>> diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
>>>> index fe78c4626e45..f2115dfa24a5 100755
>>>> --- a/tools/perf/tests/shell/test_arm_coresight.sh
>>>> +++ b/tools/perf/tests/shell/test_arm_coresight.sh
>>>> @@ -12,12 +12,12 @@
>>>> glb_err=0
>>>> 
>>>> cs_etm_dev_name() {
>>>> - cs_etm_path=$(find  /sys/bus/event_source/devices/cs_etm/ -name cpu* -print -quit)
>>>> + cs_etm_path=$(find  /sys/bus/event_source/devices/cs_etm/ -name 'cpu*' -print -quit)
>>>> trcdevarch=$(cat ${cs_etm_path}/mgmt/trcdevarch)
>>>> archhver=$((($trcdevarch >> 12) & 0xf))
>>>> archpart=$(($trcdevarch & 0xfff))
>>>> 
>>>> - if [ $archhver -eq 5 -a "$(printf "0x%X\n" $archpart)" = "0xA13" ] ; then
>>>> + if [ $archhver -eq 5 ] && [ "$(printf "0x%X\n" $archpart)" = "0xA13" ] ; then
>>>> echo "ete"
>>>> else
>>>> echo "etm"
>>> 
>>> 
>>> Reviewed-by: James Clark <james.clark at arm.com>
> 
> Some are not applying, even after b4 picking up v2
> 
> Total patches: 3
> ---
> Cover: ./v2_20231013_atrajeev_fix_for_shellcheck_issues_with_latest_scripts_in_tests_shell.cover
> Link: https://lore.kernel.org/r/20231013073021.99794-1-atrajeev@linux.vnet.ibm.com
> Base: not specified
>       git am ./v2_20231013_atrajeev_fix_for_shellcheck_issues_with_latest_scripts_in_tests_shell.mbx
> ⬢[acme at toolbox perf-tools-next]$        git am ./v2_20231013_atrajeev_fix_for_shellcheck_issues_with_latest_scripts_in_tests_shell.mbx
> Applying: tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention
> error: patch failed: tools/perf/tests/shell/lock_contention.sh:33
> error: tools/perf/tests/shell/lock_contention.sh: patch does not apply
> Patch failed at 0001 tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
> ⬢[acme at toolbox perf-tools-next]$ git am --abort
> ⬢[acme at toolbox perf-tools-next]$

Hi Arnaldo

The patch is picked up : https://lore.kernel.org/all/169757198796.167943.10552920255799914362.b4-ty@kernel.org/ .
Thanks for looking into.

Athira




More information about the Linuxppc-dev mailing list