All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython
@ 2022-10-20 19:29 Namhyung Kim
  2022-10-20 23:44 ` Ian Rogers
  2022-10-21  5:22 ` Adrian Hunter
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2022-10-20 19:29 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ingo Molnar, Peter Zijlstra, LKML, Ian Rogers, Adrian Hunter,
	linux-perf-users, Ammy Yi

The virtuall LBR test uses a python script to check the max size of
branch stack in the Intel-PT generated LBR.  But it didn't check whether
python scripting is available (as it's optional).

Let's skip the test if the python support is not available.

Fixes: f77811a0f625 ("perf test: test_intel_pt.sh: Add 9 tests")
Cc: Ammy Yi <ammy.yi@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
index 4c0aabbe33bd..e66b7d977462 100755
--- a/tools/perf/tests/shell/test_intel_pt.sh
+++ b/tools/perf/tests/shell/test_intel_pt.sh
@@ -526,6 +526,12 @@ test_kernel_trace()
 test_virtual_lbr()
 {
 	echo "--- Test virtual LBR ---"
+	# Check if python script is supported
+	libpython=$(ldd $(which perf) | grep -c python)
+	if [ "${libpython}" != "1" ] ; then
+		echo "SKIP: python scripting is not supported"
+		return 2
+	fi
 
 	# Python script to determine the maximum size of branch stacks
 	cat << "_end_of_file_" > "${maxbrstack}"
-- 
2.38.0.135.g90850a2211-goog


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

* Re: [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython
  2022-10-20 19:29 [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython Namhyung Kim
@ 2022-10-20 23:44 ` Ian Rogers
  2022-10-21  5:22 ` Adrian Hunter
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Rogers @ 2022-10-20 23:44 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ingo Molnar, Peter Zijlstra,
	LKML, Adrian Hunter, linux-perf-users, Ammy Yi

On Thu, Oct 20, 2022 at 12:29 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> The virtuall LBR test uses a python script to check the max size of
> branch stack in the Intel-PT generated LBR.  But it didn't check whether
> python scripting is available (as it's optional).
>
> Let's skip the test if the python support is not available.
>
> Fixes: f77811a0f625 ("perf test: test_intel_pt.sh: Add 9 tests")
> Cc: Ammy Yi <ammy.yi@intel.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
> index 4c0aabbe33bd..e66b7d977462 100755
> --- a/tools/perf/tests/shell/test_intel_pt.sh
> +++ b/tools/perf/tests/shell/test_intel_pt.sh
> @@ -526,6 +526,12 @@ test_kernel_trace()
>  test_virtual_lbr()
>  {
>         echo "--- Test virtual LBR ---"
> +       # Check if python script is supported
> +       libpython=$(ldd $(which perf) | grep -c python)
> +       if [ "${libpython}" != "1" ] ; then

Perhaps use -vv (taking care not to match "on" against "python"):

if perf -vv|grep libpython|grep -q " on"; then

Thanks,
Ian

> +               echo "SKIP: python scripting is not supported"
> +               return 2
> +       fi
>
>         # Python script to determine the maximum size of branch stacks
>         cat << "_end_of_file_" > "${maxbrstack}"
> --
> 2.38.0.135.g90850a2211-goog
>

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

* Re: [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython
  2022-10-20 19:29 [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython Namhyung Kim
  2022-10-20 23:44 ` Ian Rogers
@ 2022-10-21  5:22 ` Adrian Hunter
  2022-10-21 16:25   ` Namhyung Kim
  1 sibling, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2022-10-21  5:22 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ingo Molnar, Peter Zijlstra, LKML, Ian Rogers, linux-perf-users, Ammy Yi

On 20/10/22 22:29, Namhyung Kim wrote:
> The virtuall LBR test uses a python script to check the max size of
> branch stack in the Intel-PT generated LBR.  But it didn't check whether
> python scripting is available (as it's optional).
> 
> Let's skip the test if the python support is not available.
> 
> Fixes: f77811a0f625 ("perf test: test_intel_pt.sh: Add 9 tests")
> Cc: Ammy Yi <ammy.yi@intel.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
> index 4c0aabbe33bd..e66b7d977462 100755
> --- a/tools/perf/tests/shell/test_intel_pt.sh
> +++ b/tools/perf/tests/shell/test_intel_pt.sh
> @@ -526,6 +526,12 @@ test_kernel_trace()
>  test_virtual_lbr()
>  {
>  	echo "--- Test virtual LBR ---"
> +	# Check if python script is supported
> +	libpython=$(ldd $(which perf) | grep -c python)

'which' might not be installed.  Don't about 'ldd'.

Maybe 'perf version --build-options' can be used instead e.g.

$ perf version --build-options | grep -i libpython | grep -vi off
             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT

> +	if [ "${libpython}" != "1" ] ; then
> +		echo "SKIP: python scripting is not supported"
> +		return 2
> +	fi
>  
>  	# Python script to determine the maximum size of branch stacks
>  	cat << "_end_of_file_" > "${maxbrstack}"


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

* Re: [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython
  2022-10-21  5:22 ` Adrian Hunter
@ 2022-10-21 16:25   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2022-10-21 16:25 UTC (permalink / raw)
  To: Adrian Hunter, Ian Rogers
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ingo Molnar, Peter Zijlstra,
	LKML, linux-perf-users, Ammy Yi

Hi Adrian and Ian,

On Thu, Oct 20, 2022 at 10:22 PM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 20/10/22 22:29, Namhyung Kim wrote:
> > The virtuall LBR test uses a python script to check the max size of
> > branch stack in the Intel-PT generated LBR.  But it didn't check whether
> > python scripting is available (as it's optional).
> >
> > Let's skip the test if the python support is not available.
> >
> > Fixes: f77811a0f625 ("perf test: test_intel_pt.sh: Add 9 tests")
> > Cc: Ammy Yi <ammy.yi@intel.com>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
> > index 4c0aabbe33bd..e66b7d977462 100755
> > --- a/tools/perf/tests/shell/test_intel_pt.sh
> > +++ b/tools/perf/tests/shell/test_intel_pt.sh
> > @@ -526,6 +526,12 @@ test_kernel_trace()
> >  test_virtual_lbr()
> >  {
> >       echo "--- Test virtual LBR ---"
> > +     # Check if python script is supported
> > +     libpython=$(ldd $(which perf) | grep -c python)
>
> 'which' might not be installed.  Don't about 'ldd'.
>
> Maybe 'perf version --build-options' can be used instead e.g.
>
> $ perf version --build-options | grep -i libpython | grep -vi off
>              libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT

Thanks for the suggestion, will change.

Thanks,
Namhyung

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

end of thread, other threads:[~2022-10-21 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 19:29 [PATCH] perf test: Do not fail Intel-PT misc test w/o libpython Namhyung Kim
2022-10-20 23:44 ` Ian Rogers
2022-10-21  5:22 ` Adrian Hunter
2022-10-21 16:25   ` Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.