Skip to contentSkip to conversation

VSP-Tests: unbind:

PATCH In review Kieran Bingham 2 participants 7 messages Sep 18, 2020 – Sep 19, 2020

lore
Share & tools
lore
#0 lore raw

cover VSP-Tests: unbind:

The VSP unbind test recently added causes an issue when the VSP utilised by the DU is unbound and rebound.

That needs to be fixed, but will be handled separately - so we limit the scope to allow running the remaining tests for now.

As the unbind test requires root to run, skip it if it's run by a normal user, and while were here - remove an unused variable identified during the creation of these patches.

Kieran Bingham (3):
scripts: vsp-lib.sh: Remove unused variable
tests: Skip unbind/bind tests when not root
tests: unbind/bind: Only test non display VSPs

 scripts/vsp-lib.sh          |  2 --
 tests/vsp-unit-test-0026.sh | 17 +++++++++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 scripts: vsp-lib.sh: Remove unused variable

The dev identifier is not used until after a media device has been selected, at which point the vsp1_device function is re-called.

Remove the redundant assignment.

---
 scripts/vsp-lib.sh | 2 --
 1 file changed, 2 deletions(-)
scripts/vsp-lib.sh +0 -2
index a8898e80a879..04a8127f6073 100755
@@ -1040,8 +1040,6 @@ test_init() {
 	local best_mdev=
 
 	for mdev in /dev/media* ; do
-		dev=$(vsp1_device $mdev)
-
 		local match='true'
 		for feature in $features ; do
 			$(vsp1_has_feature "$feature") || {
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 tests: Skip unbind/bind tests when not root

In reply to Kieran Bingham

The user must be root to be able to perform the unbind/bind cycle. Skip this test when the user does not have root privilidges.

---
 tests/vsp-unit-test-0026.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tests/vsp-unit-test-0026.sh +6 -0
index 0e013cec881b..88038f3fdebf 100755
@@ -41,6 +41,12 @@ test_copy() {
 test_main() {
 	local format
 
+	if [ ! "$(id -u)" = 0 ] ; then
+		# Root is required to run unbind tests
+		test_complete skip
+		return
+	fi
+
 	# Unbind and rebind VSPs individually
 	for v in $vsps; do
 		unbind_vsp $v
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH 2/3] tests: Skip unbind/bind tests when not root

Hi Kieran

Quoted 13 lines · Kieran Bingham

The user must be root to be able to perform the unbind/bind cycle. Skip this test when the user does not have root privilidges.

---
 tests/vsp-unit-test-0026.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tests/vsp-unit-test-0026.sh +0 -0
index 0e013cec881b..88038f3fdebf 100755

tests/vsp-unit-test-0026.sh test_copy() { · line 46

Quoted 6 lines
tests/vsp-unit-test-0026.sh +3 -0
@@ -41,6 +41,12 @@ test_copy() {
 test_main() {
 	local format
 
+	if [ ! "$(id -u)" = 0 ] ; then
+		# Root is required to run unbind tests
+		test_complete skip

Ugh, this is a bit annoying as it generates a warning on the output actually, as we haven't yet called test_start.

We could do a test_start "Rebinding VSPs", and then it will either skip or pass. But any failures would be in the kernel logs...

Quoted 7 lines
tests/vsp-unit-test-0026.sh +3 -0
+		return
+	fi
+
 	# Unbind and rebind VSPs individually
 	for v in $vsps; do
 		unbind_vsp $v
Signature · 3 lines
Regards
--
Kieran
#4 lore raw

PATCH v2 1/1 tests: Skip unbind/bind tests when not root

In reply to Kieran Bingham

The user must be root to be able to perform the unbind/bind cycle. Skip this test when the user does not have root privilidges.

---
v2:
- Provide a test_start to match the test_complete operations.

 tests/vsp-unit-test-0026.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
tests/vsp-unit-test-0026.sh +11 -0
index 0e013cec881b..391986e77336 100755
@@ -41,12 +41,23 @@ test_copy() {
 test_main() {
 	local format
 
+	test_start "rebinding VSPs"
+
+	if [ ! "$(id -u)" = 0 ] ; then
+		# Root is required to run unbind tests
+		test_complete skip
+		return
+	fi
+
 	# Unbind and rebind VSPs individually
 	for v in $vsps; do
 		unbind_vsp $v
 		bind_vsp $v
 	done
 
+	# The test passes if the kernel doesn't crash
+	test_complete pass
+
 	# Perform a simple copy test to validate HW is alive
 	test_copy RGB24 128x128
 }
Signature · 1 line
2.25.1
#5 lore raw

PATCH 3/3 tests: unbind/bind: Only test non display VSPs

In reply to Kieran Bingham

Only perform bind/unbind testing on VSPs which expose a media-device. Unbinding a VSP which is connected to a DU causes the display pipeline to fail, and is not currently supported.

---
 tests/vsp-unit-test-0026.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tests/vsp-unit-test-0026.sh +9 -2
index 88038f3fdebf..4185bb23d05b 100755
@@ -10,7 +10,14 @@
 features="rpf.0 wpf.0"
 
 vsp1_driver=/sys/bus/platform/drivers/vsp1
-vsps=$(cd /sys/bus/platform/devices/; ls | grep vsp)
+
+# List all VSPs with a media device.
+# This exludes VSP devices used by the DU.
+list_vsps() {
+	for mdev in /dev/media* ; do
+		echo -n $(vsp1_device $mdev) | grep vsp
+	done
+}
 
 unbind_vsp() {
 	echo $1 > $vsp1_driver/unbind
@@ -48,7 +55,7 @@ test_main() {
 	fi
 
 	# Unbind and rebind VSPs individually
-	for v in $vsps; do
+	for v in $(list_vsps); do
 		unbind_vsp $v
 		bind_vsp $v
 	done
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH 3/3] tests: unbind/bind: Only test non display VSPs

Hello!

Quoted 14 lines · Kieran Bingham

Only perform bind/unbind testing on VSPs which expose a media-device. Unbinding a VSP which is connected to a DU causes the display pipeline to fail, and is not currently supported.

---
  tests/vsp-unit-test-0026.sh | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
tests/vsp-unit-test-0026.sh +0 -0
index 88038f3fdebf..4185bb23d05b 100755

tests/vsp-unit-test-0026.sh line 15

Quoted 7 lines
tests/vsp-unit-test-0026.sh +3 -1
@@ -10,7 +10,14 @@
  features="rpf.0 wpf.0"
 
  vsp1_driver=/sys/bus/platform/drivers/vsp1
-vsps=$(cd /sys/bus/platform/devices/; ls | grep vsp)
+
+# List all VSPs with a media device.
+# This exludes VSP devices used by the DU.

Excludes. :-)

[...]

MBR, Sergei