linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: Ian Rogers <irogers@google.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	maddy@linux.vnet.ibm.com,
	Nageswara Sastry <rnsastry@linux.ibm.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	linux-perf-users@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	Disha Goel <disgoel@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] tools/perf/tests: Fix string substitutions in build id test
Date: Tue, 17 Jan 2023 18:44:44 +0530	[thread overview]
Message-ID: <8356580F-4D16-47E2-95C7-AD43B3CD437C@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAP-5=fXS+8Wg8+Qrob+7fb5Y6FeBQphzd=Y0a1eh6xNwc-SfYA@mail.gmail.com>



> On 17-Jan-2023, at 3:30 AM, Ian Rogers <irogers@google.com> wrote:
> 
> On Mon, Jan 16, 2023 at 4:00 AM Athira Rajeev
> <atrajeev@linux.vnet.ibm.com> wrote:
>> 
>> 
>> 
>>> On 16-Jan-2023, at 11:47 AM, Ian Rogers <irogers@google.com> wrote:
>>> 
>>> On Sun, Jan 15, 2023 at 9:03 PM Athira Rajeev
>>> <atrajeev@linux.vnet.ibm.com> wrote:
>>>> 
>>>> 
>>>> 
>>>>> On 28-Sep-2022, at 10:24 AM, Athira Rajeev <atrajeev@linux.vnet.ibm.com> wrote:
>>>>> 
>>>>> Hi All,
>>>>> 
>>>>> Looking for what direction we can take here.
>>>>> Do we want to change all tests in tools/perf/tests/shell except test_intel_pt.sh to use "bash" or go with
>>>>> the approach in the patch ? Please share your comments
>>>>> 
>>>>> Thanks
>>>>> Athira
>>>>> 
>>>> 
>>>> Hi All,
>>>> 
>>>> Looking for what direction we can take here.
>>>> Do we want to change all tests in tools/perf/tests/shell except test_intel_pt.sh to use "bash" or go with
>>>> the approach in the patch ? Please share your comments
>>>> 
>>>> Thanks
>>>> Athira
>>> 
>> 
>> Thanks Ian for the response.
>> 
>>> I think some of what the patch is doing is good, some of it the
>> 
>> Ian, can I take this as an ack for the patch so that Arnaldo can pick this in acme git ?
> 
> Acked-by: Ian Rogers <irogers@google.com>
> 
> Thanks,
> Ian

Thanks Ian.

Hi Arnaldo,

I have re-posted the patch 2 ( in this series ) separately in new patchset here :
https://lore.kernel.org/linux-perf-users/20230116050131.17221-2-atrajeev@linux.vnet.ibm.com/

Ack from Ian is for Patch 1. Shall I rebase to upstream and post this patch 1 separately ?

Thanks
Athira
> 
>>> readability becomes a little harder by not being bash. I'm agnostic as
>>> to which approach to take for the fix.
>> 
>> May be we can take this as separate mail thread to get everyone’s opinion on changing all tests in "tools/perf/tests/shell" except test_intel_pt.sh to use “bash" ?
>> 
>>> 
>>> An aside, I noticed that we do run some tests at build time:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/lib/Makefile?h=perf/core#n390
>>> So perhaps we can have a shellcheck build option, defaulted off but
>>> enabled as part of Arnaldo's regular test scripts. The shellcheck
>>> build option would run shellcheck to make sure that there weren't
>>> errors in the shell code, which it is far too easy to introduce.
>> 
>> Sure, that is a good option to have. I will check on having “shellcheck" as a build option.
>> 
>> Thanks
>> Athira
>> 
>>> 
>>> Thanks,
>>> Ian
>>> 
>>>>>> On 23-Sep-2022, at 11:54 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>>>> 
>>>>>> On 22/09/22 22:15, Arnaldo Carvalho de Melo wrote:
>>>>>>> Em Wed, Sep 21, 2022 at 10:38:38PM +0530, Athira Rajeev escreveu:
>>>>>>>> The perf test named “build id cache operations” skips with below
>>>>>>>> error on some distros:
>>>>>>> 
>>>>>>> I wonder if we shouldn't instead state that bash is needed?
>>>>>>> 
>>>>>>> ⬢[acme@toolbox perf-urgent]$ head -1 tools/perf/tests/shell/*.sh | grep ^#
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/bash
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/bash
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/bash
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/bash
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> #!/bin/sh
>>>>>>> ⬢[acme@toolbox perf-urgent]$
>>>>>>> 
>>>>>>> Opinions?
>>>>>>> 
>>>>>> 
>>>>>> Please don't change tools/perf/tests/shell/test_intel_pt.sh
>>>>>> 
>>>>>> I started using shellcheck on that with the "perf test:
>>>>>> test_intel_pt.sh: Add per-thread test" patch set that I sent.
>>>>>> 
>>>>>> FYI, if you use shellcheck on buildid.sh, it shows up issues even
>>>>>> after changing to bash:
>>>>>> 
>>>>>> *** Before ***
>>>>>> 
>>>>>> $ shellcheck -S warning tools/perf/tests/shell/buildid.sh
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 69:
>>>>>>     link=${build_id_dir}/.build-id/${id:0:2}/${id:2}
>>>>>>                                    ^-------^ SC2039: In POSIX sh, string indexing is undefined.
>>>>>>                                              ^-----^ SC2039: In POSIX sh, string indexing is undefined.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 77:
>>>>>>     file=${build_id_dir}/.build-id/${id:0:2}/`readlink ${link}`/elf
>>>>>>                                    ^-------^ SC2039: In POSIX sh, string indexing is undefined.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 123:
>>>>>>     echo "running: perf record $@"
>>>>>>                                ^-- SC2145: Argument mixes string and array. Use * or separate argument.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 124:
>>>>>>     ${perf} record --buildid-all -o ${data} $@ &> ${log}
>>>>>>                                             ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
>>>>>>                                                ^-------^ SC2039: In POSIX sh, &> is undefined.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 126:
>>>>>>             echo "failed: record $@"
>>>>>>                                  ^-- SC2145: Argument mixes string and array. Use * or separate argument.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 131:
>>>>>>     check ${@: -1}
>>>>>>           ^------^ SC2068: Double quote array expansions to avoid re-splitting elements.
>>>>>>           ^------^ SC2039: In POSIX sh, string indexing is undefined.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 158:
>>>>>> exit ${err}
>>>>>>  ^----^ SC2154: err is referenced but not assigned.
>>>>>> 
>>>>>> For more information:
>>>>>> https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
>>>>>> https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ...
>>>>>> https://www.shellcheck.net/wiki/SC2039 -- In POSIX sh, &> is undefined.
>>>>>> 
>>>>>> *** After ***
>>>>>> 
>>>>>> $ shellcheck -S warning tools/perf/tests/shell/buildid.sh
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 123:
>>>>>>     echo "running: perf record $@"
>>>>>>                                ^-- SC2145: Argument mixes string and array. Use * or separate argument.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 124:
>>>>>>     ${perf} record --buildid-all -o ${data} $@ &> ${log}
>>>>>>                                             ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 126:
>>>>>>             echo "failed: record $@"
>>>>>>                                  ^-- SC2145: Argument mixes string and array. Use * or separate argument.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 131:
>>>>>>     check ${@: -1}
>>>>>>           ^------^ SC2068: Double quote array expansions to avoid re-splitting elements.
>>>>>> 
>>>>>> 
>>>>>> In tools/perf/tests/shell/buildid.sh line 158:
>>>>>> exit ${err}
>>>>>>  ^----^ SC2154: err is referenced but not assigned.
>>>>>> 
>>>>>> For more information:
>>>>>> https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
>>>>>> https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ...
>>>>>> https://www.shellcheck.net/wiki/SC2154 -- err is referenced but not assigned.


      reply	other threads:[~2023-01-17 13:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 17:08 [PATCH 1/2] tools/perf/tests: Fix string substitutions in build id test Athira Rajeev
2022-09-21 17:08 ` [PATCH 2/2] tools/perf/tests: Fix build id test check for PE file Athira Rajeev
2022-09-22 19:15 ` [PATCH 1/2] tools/perf/tests: Fix string substitutions in build id test Arnaldo Carvalho de Melo
2022-09-22 23:44   ` Ian Rogers
2022-09-23  6:24   ` Adrian Hunter
2022-09-28  4:54     ` Athira Rajeev
2023-01-16  5:02       ` Athira Rajeev
2023-01-16  6:17         ` Ian Rogers
2023-01-16 11:59           ` Athira Rajeev
2023-01-16 22:00             ` Ian Rogers
2023-01-17 13:14               ` Athira Rajeev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8356580F-4D16-47E2-95C7-AD43B3CD437C@linux.vnet.ibm.com \
    --to=atrajeev@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=disgoel@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kjain@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=rnsastry@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).