Skip to contentSkip to conversation

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

PATCH Superseded Namhyung Kim 3 participants 4 messages Oct 20, 2022 – Oct 21, 2022 perf events

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf test: Do not fail Intel-PT misc test w/o libpython

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 <[email protected]>
---
 tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/test_intel_pt.sh +6 -0
index 4c0aabbe33bd..e66b7d977462 100755
@@ -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}"
Signature · 1 line
2.38.0.135.g90850a2211-goog
reviewer
#1 lore raw
Quoted 19 lines · Namhyung Kim

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 <[email protected]>
---
 tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/test_intel_pt.sh +0 -0
index 4c0aabbe33bd..e66b7d977462 100755

tools/perf/tests/shell/test_intel_pt.sh test_kernel_trace() · line 531

Quoted 6 lines
tools/perf/tests/shell/test_intel_pt.sh +3 -0
@@ -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

Quoted 9 lines
tools/perf/tests/shell/test_intel_pt.sh +3 -1
+               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

reviewer
#2 lore raw
In reply to Namhyung Kim
Quoted 18 lines · Namhyung Kim

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 <[email protected]>
---
 tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/test_intel_pt.sh +0 -0
index 4c0aabbe33bd..e66b7d977462 100755

tools/perf/tests/shell/test_intel_pt.sh test_kernel_trace() · line 530

Quoted 5 lines
tools/perf/tests/shell/test_intel_pt.sh +2 -0
@@ -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
Quoted 7 lines
tools/perf/tests/shell/test_intel_pt.sh +4 -0
+	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}"
author maintainer
#3 lore raw

Hi Adrian and Ian,

Quoted 28 lines · Adrian Hunter
Quoted 18 lines · Namhyung Kim

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 <[email protected]>
---
 tools/perf/tests/shell/test_intel_pt.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/test_intel_pt.sh +0 -0
index 4c0aabbe33bd..e66b7d977462 100755

tools/perf/tests/shell/test_intel_pt.sh test_kernel_trace() · line 530

Quoted 5 lines
tools/perf/tests/shell/test_intel_pt.sh +2 -0
@@ -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'.

Quoted 4 lines

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