[v2] perf test: Do not fail Intel-PT misc test w/o libpython

Message ID 20221021181055.60183-1-namhyung@kernel.org
State New
Headers
Series [v2] perf test: Do not fail Intel-PT misc test w/o libpython |

Commit Message

Namhyung Kim Oct. 21, 2022, 6:10 p.m. UTC
  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(+)
  

Comments

Ian Rogers Oct. 21, 2022, 10 p.m. UTC | #1
On Fri, Oct 21, 2022 at 11:11 AM Namhyung Kim <namhyung@kernel.org> wrote:
>
> The virtuall LBR test uses a python script to check the max size of

nit: virtual

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

Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  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..f5ed7b1af419 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=$(perf version --build-options | grep python | grep -cv OFF)
> +       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
>
  
Adrian Hunter Oct. 23, 2022, 4:46 p.m. UTC | #2
On 21/10/22 21:10, 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>

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  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..f5ed7b1af419 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=$(perf version --build-options | grep python | grep -cv OFF)
> +	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}"
  
Arnaldo Carvalho de Melo Oct. 24, 2022, 11:39 a.m. UTC | #3
Em Fri, Oct 21, 2022 at 03:00:04PM -0700, Ian Rogers escreveu:
> On Fri, Oct 21, 2022 at 11:11 AM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > The virtuall LBR test uses a python script to check the max size of
> 
> nit: virtual

Thanks, fixed and applied.

- Arnaldo
 
> > 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>
> 
> Acked-by: Ian Rogers <irogers@google.com>
> 
> Thanks,
> Ian
> 
> > ---
> >  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..f5ed7b1af419 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=$(perf version --build-options | grep python | grep -cv OFF)
> > +       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
> >
  

Patch

diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
index 4c0aabbe33bd..f5ed7b1af419 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=$(perf version --build-options | grep python | grep -cv OFF)
+	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}"