linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell
@ 2023-10-13  7:30 Athira Rajeev
  2023-10-13  7:30 ` [PATCH V2 1/3] tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention Athira Rajeev
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Athira Rajeev @ 2023-10-13  7:30 UTC (permalink / raw)
  To: acme, jolsa, adrian.hunter, irogers, namhyung
  Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel

shellcheck was run on perf tool shell scripts as a pre-requisite
to include a build option for shellcheck discussed here:
https://www.spinics.net/lists/linux-perf-users/msg25553.html

And fixes were added for the coding/formatting issues in
two patchsets:
https://lore.kernel.org/linux-perf-users/20230613164145.50488-1-atrajeev@linux.vnet.ibm.com/
https://lore.kernel.org/linux-perf-users/20230709182800.53002-1-atrajeev@linux.vnet.ibm.com/

Three additional issues were observed and fixes are part of:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git

With recent commits in perf, other three issues are observed.
shellcheck version: 0.6.0
The changes are with recent commits ( which is mentioned in each patch)
for lock_contention, record_sideband and stat_all_metricgroups test.
Patch series fixes these testcases and patches are on top of:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git

The version 1 patchset had fix patch for test_arm_coresight.sh.
Dropping that in V2 based on discussion here:
https://lore.kernel.org/linux-perf-users/F265857D-0D37-4878-908C-D20732F212F9@linux.vnet.ibm.com/T/#u

Athira Rajeev (3):
  tools/perf/tests Ignore the shellcheck SC2046 warning in
    lock_contention
  tools/perf/tests: Fix shellcheck warning in record_sideband.sh test
  tools/perf/tests/shell: Fix shellcheck warning SC2112 with
    stat_all_metricgroups

 tools/perf/tests/shell/lock_contention.sh       | 1 +
 tools/perf/tests/shell/record_sideband.sh       | 2 +-
 tools/perf/tests/shell/stat_all_metricgroups.sh | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V2 1/3] tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention
  2023-10-13  7:30 [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Athira Rajeev
@ 2023-10-13  7:30 ` Athira Rajeev
  2023-10-13  7:30 ` [PATCH V2 2/3] tools/perf/tests: Fix shellcheck warning in record_sideband.sh test Athira Rajeev
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Athira Rajeev @ 2023-10-13  7:30 UTC (permalink / raw)
  To: acme, jolsa, adrian.hunter, irogers, namhyung
  Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel

Running shellcheck on lock_contention.sh generates below
warning

	In tests/shell/lock_contention.sh line 36:
	   if [ `nproc` -lt 4 ]; then
		  ^-----^ SC2046: Quote this to prevent word splitting.

Here since nproc will generate a single word output
and there is no possibility of word splitting, this
warning can be ignored. Use exception for this with
"disable" option in shellcheck. This warning is observed
after commit:
"commit 29441ab3a30a ("perf test lock_contention.sh: Skip test
if not enough CPUs")"

Fixes: 29441ab3a30a ("perf test lock_contention.sh: Skip test if not enough CPUs")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
---
changelog:
 v1 -> v2:
 Add Reviewed-by from Kajol Jain

 tools/perf/tests/shell/lock_contention.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/shell/lock_contention.sh b/tools/perf/tests/shell/lock_contention.sh
index d5a191d3d090..c1ec5762215b 100755
--- a/tools/perf/tests/shell/lock_contention.sh
+++ b/tools/perf/tests/shell/lock_contention.sh
@@ -33,6 +33,7 @@ check() {
 		exit
 	fi
 
+	# shellcheck disable=SC2046
 	if [ `nproc` -lt 4 ]; then
 		echo "[Skip] Low number of CPUs (`nproc`), lock event cannot be triggered certainly"
 		err=2
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 2/3] tools/perf/tests: Fix shellcheck warning in record_sideband.sh test
  2023-10-13  7:30 [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Athira Rajeev
  2023-10-13  7:30 ` [PATCH V2 1/3] tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention Athira Rajeev
@ 2023-10-13  7:30 ` Athira Rajeev
  2023-10-13  7:30 ` [PATCH V2 3/3] tools/perf/tests/shell: Fix shellcheck warning SC2112 with stat_all_metricgroups Athira Rajeev
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Athira Rajeev @ 2023-10-13  7:30 UTC (permalink / raw)
  To: acme, jolsa, adrian.hunter, irogers, namhyung
  Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel

Running shellcheck on record_sideband.sh throws below
warning:

	In tests/shell/record_sideband.sh line 25:
	  if ! perf record -o ${perfdata} -BN --no-bpf-event -C $1 true 2>&1 >/dev/null
	    ^--^ SC2069: To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).

This shows shellcheck warning SC2069 where the redirection
order needs to be fixed. Use "cmd > /dev/null 2>&1" to fix
the redirection of perf record output

Fixes: 23b97c7ee963 ("perf test: Add test case for record sideband events")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
---
changelog:
 v1 -> v2:
 Add Reviewed-by from Kajol
 Used "cmd > /dev/null 2>&1" to fix the redirection
 warning from shellcheck

 tools/perf/tests/shell/record_sideband.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/record_sideband.sh b/tools/perf/tests/shell/record_sideband.sh
index 5024a7ce0c51..ac70ac27d590 100755
--- a/tools/perf/tests/shell/record_sideband.sh
+++ b/tools/perf/tests/shell/record_sideband.sh
@@ -22,7 +22,7 @@ trap trap_cleanup EXIT TERM INT
 
 can_cpu_wide()
 {
-    if ! perf record -o ${perfdata} -BN --no-bpf-event -C $1 true 2>&1 >/dev/null
+    if ! perf record -o ${perfdata} -BN --no-bpf-event -C $1 true > /dev/null 2>&1
     then
         echo "record sideband test [Skipped cannot record cpu$1]"
         err=2
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 3/3] tools/perf/tests/shell: Fix shellcheck warning SC2112 with stat_all_metricgroups
  2023-10-13  7:30 [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Athira Rajeev
  2023-10-13  7:30 ` [PATCH V2 1/3] tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention Athira Rajeev
  2023-10-13  7:30 ` [PATCH V2 2/3] tools/perf/tests: Fix shellcheck warning in record_sideband.sh test Athira Rajeev
@ 2023-10-13  7:30 ` Athira Rajeev
  2023-10-17  2:04 ` [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Namhyung Kim
  2023-10-17 19:55 ` Namhyung Kim
  4 siblings, 0 replies; 6+ messages in thread
From: Athira Rajeev @ 2023-10-13  7:30 UTC (permalink / raw)
  To: acme, jolsa, adrian.hunter, irogers, namhyung
  Cc: linux-perf-users, linuxppc-dev, maddy, atrajeev, kjain, disgoel

Running shellcheck on stat_all_metricgroups.sh reports
below warning:

 In ./tests/shell/stat_all_metricgroups.sh line 7:
 function ParanoidAndNotRoot()
 ^-- SC2112: 'function' keyword is non-standard. Delete it.

As per the format, "function" is a non-standard keyword that
can be used to declare functions. Fix this by removing the
"function" keyword from ParanoidAndNotRoot function

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
Changelog:
 This is a new patch added in V2

 tools/perf/tests/shell/stat_all_metricgroups.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh
index f3e305649e2c..55ef9c9ded2d 100755
--- a/tools/perf/tests/shell/stat_all_metricgroups.sh
+++ b/tools/perf/tests/shell/stat_all_metricgroups.sh
@@ -4,7 +4,7 @@
 
 set -e
 
-function ParanoidAndNotRoot()
+ParanoidAndNotRoot()
 {
   [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
 }
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell
  2023-10-13  7:30 [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Athira Rajeev
                   ` (2 preceding siblings ...)
  2023-10-13  7:30 ` [PATCH V2 3/3] tools/perf/tests/shell: Fix shellcheck warning SC2112 with stat_all_metricgroups Athira Rajeev
@ 2023-10-17  2:04 ` Namhyung Kim
  2023-10-17 19:55 ` Namhyung Kim
  4 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2023-10-17  2:04 UTC (permalink / raw)
  To: Athira Rajeev
  Cc: acme, jolsa, adrian.hunter, irogers, linux-perf-users,
	linuxppc-dev, maddy, kjain, disgoel

Hello,

On Fri, Oct 13, 2023 at 12:31 AM Athira Rajeev
<atrajeev@linux.vnet.ibm.com> wrote:
>
> shellcheck was run on perf tool shell scripts as a pre-requisite
> to include a build option for shellcheck discussed here:
> https://www.spinics.net/lists/linux-perf-users/msg25553.html
>
> And fixes were added for the coding/formatting issues in
> two patchsets:
> https://lore.kernel.org/linux-perf-users/20230613164145.50488-1-atrajeev@linux.vnet.ibm.com/
> https://lore.kernel.org/linux-perf-users/20230709182800.53002-1-atrajeev@linux.vnet.ibm.com/
>
> Three additional issues were observed and fixes are part of:
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
>
> With recent commits in perf, other three issues are observed.
> shellcheck version: 0.6.0
> The changes are with recent commits ( which is mentioned in each patch)
> for lock_contention, record_sideband and stat_all_metricgroups test.
> Patch series fixes these testcases and patches are on top of:
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
>
> The version 1 patchset had fix patch for test_arm_coresight.sh.
> Dropping that in V2 based on discussion here:
> https://lore.kernel.org/linux-perf-users/F265857D-0D37-4878-908C-D20732F212F9@linux.vnet.ibm.com/T/#u
>
> Athira Rajeev (3):
>   tools/perf/tests Ignore the shellcheck SC2046 warning in
>     lock_contention
>   tools/perf/tests: Fix shellcheck warning in record_sideband.sh test
>   tools/perf/tests/shell: Fix shellcheck warning SC2112 with
>     stat_all_metricgroups

For the series,
Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell
  2023-10-13  7:30 [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Athira Rajeev
                   ` (3 preceding siblings ...)
  2023-10-17  2:04 ` [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Namhyung Kim
@ 2023-10-17 19:55 ` Namhyung Kim
  4 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2023-10-17 19:55 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, adrian.hunter, irogers, jolsa,
	Athira Rajeev
  Cc: Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users, linuxppc-dev,
	maddy, disgoel, kjain

On Fri, 13 Oct 2023 13:00:18 +0530, Athira Rajeev wrote:
> shellcheck was run on perf tool shell scripts as a pre-requisite
> to include a build option for shellcheck discussed here:
> https://www.spinics.net/lists/linux-perf-users/msg25553.html
> 
> And fixes were added for the coding/formatting issues in
> two patchsets:
> https://lore.kernel.org/linux-perf-users/20230613164145.50488-1-atrajeev@linux.vnet.ibm.com/
> https://lore.kernel.org/linux-perf-users/20230709182800.53002-1-atrajeev@linux.vnet.ibm.com/
> 
> [...]

Applied to perf-tools-next, thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-17 19:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13  7:30 [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Athira Rajeev
2023-10-13  7:30 ` [PATCH V2 1/3] tools/perf/tests Ignore the shellcheck SC2046 warning in lock_contention Athira Rajeev
2023-10-13  7:30 ` [PATCH V2 2/3] tools/perf/tests: Fix shellcheck warning in record_sideband.sh test Athira Rajeev
2023-10-13  7:30 ` [PATCH V2 3/3] tools/perf/tests/shell: Fix shellcheck warning SC2112 with stat_all_metricgroups Athira Rajeev
2023-10-17  2:04 ` [PATCH V2 0/3] Fix for shellcheck issues with latest scripts in tests/shell Namhyung Kim
2023-10-17 19:55 ` Namhyung Kim

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).