diff mbox series

[VSP-Tests] tests: Provide {un,}bind testing

Message ID 20200525132148.3454488-1-kieran.bingham@ideasonboard.com (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series [VSP-Tests] tests: Provide {un,}bind testing | expand

Commit Message

Kieran Bingham May 25, 2020, 1:21 p.m. UTC
Perform unbind-bind testing of the VSP devices to validate
successful removal of the drivers.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 tests/vsp-unit-test-0026.sh | 63 +++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100755 tests/vsp-unit-test-0026.sh

Comments

Laurent Pinchart June 7, 2020, 2:31 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Mon, May 25, 2020 at 02:21:48PM +0100, Kieran Bingham wrote:
> Perform unbind-bind testing of the VSP devices to validate
> successful removal of the drivers.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  tests/vsp-unit-test-0026.sh | 63 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100755 tests/vsp-unit-test-0026.sh
> 
> diff --git a/tests/vsp-unit-test-0026.sh b/tests/vsp-unit-test-0026.sh
> new file mode 100755
> index 000000000000..86c523a65651
> --- /dev/null
> +++ b/tests/vsp-unit-test-0026.sh
> @@ -0,0 +1,63 @@
> +#!/bin/sh
> +
> +#
> +# Test unbinding and binding all VSP1 devices, performing a simple
> +# copy test to validate the hardware afterwards.
> +#
> +
> +. ./vsp-lib.sh
> +
> +features="rpf.0 wpf.0"
> +
> +vsp1_driver=/sys/bus/platform/drivers/vsp1
> +vsps=$(cd /sys/bus/platform/devices/; ls | grep vsp)
> +
> +unbind_vsp() {
> +	echo $1 > $vsp1_driver/unbind
> +}
> +
> +bind_vsp() {
> +	echo $1 > $vsp1_driver/bind
> +}
> +
> +# Input is directly copied to the output. No change in format or size.
> +test_copy() {
> +	local format=$1
> +	local insize=$2
> +
> +	test_start "simple hardware validation after unbind/bind cycles"
> +
> +	pipe_configure rpf-wpf 0 0
> +	format_configure rpf-wpf 0 0 $format $insize $format
> +
> +	vsp_runner rpf.0 &
> +	vsp_runner wpf.0
> +
> +	local result=$(compare_frames)
> +
> +	test_complete $result
> +}
> +
> +test_main() {
> +	local format
> +
> +	# Unbind and rebind individually
> +	for v in $vsps; do
> +		unbind_vsp $v;
> +		bind_vsp $v;

No need for the ; at the end of those two lines.

> +	done
> +
> +	# Unbind, then rebind all VSPs at once
> +	for v in $vsps; do
> +		unbind_vsp $v;

Same here.

> +	done
> +	for v in $vsps; do
> +		bind_vsp $v;
> +	done;

And here, including after 'done'.

Do we need both, isn't the invidual unbind/rebind enough ?

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Feel free to push after addressing those issues.

> +
> +	# Perform a simple copy test to validate HW is alive
> +	test_copy RGB24 128x128
> +}
> +
> +test_init $0 "$features"
> +test_run
diff mbox series

Patch

diff --git a/tests/vsp-unit-test-0026.sh b/tests/vsp-unit-test-0026.sh
new file mode 100755
index 000000000000..86c523a65651
--- /dev/null
+++ b/tests/vsp-unit-test-0026.sh
@@ -0,0 +1,63 @@ 
+#!/bin/sh
+
+#
+# Test unbinding and binding all VSP1 devices, performing a simple
+# copy test to validate the hardware afterwards.
+#
+
+. ./vsp-lib.sh
+
+features="rpf.0 wpf.0"
+
+vsp1_driver=/sys/bus/platform/drivers/vsp1
+vsps=$(cd /sys/bus/platform/devices/; ls | grep vsp)
+
+unbind_vsp() {
+	echo $1 > $vsp1_driver/unbind
+}
+
+bind_vsp() {
+	echo $1 > $vsp1_driver/bind
+}
+
+# Input is directly copied to the output. No change in format or size.
+test_copy() {
+	local format=$1
+	local insize=$2
+
+	test_start "simple hardware validation after unbind/bind cycles"
+
+	pipe_configure rpf-wpf 0 0
+	format_configure rpf-wpf 0 0 $format $insize $format
+
+	vsp_runner rpf.0 &
+	vsp_runner wpf.0
+
+	local result=$(compare_frames)
+
+	test_complete $result
+}
+
+test_main() {
+	local format
+
+	# Unbind and rebind individually
+	for v in $vsps; do
+		unbind_vsp $v;
+		bind_vsp $v;
+	done
+
+	# Unbind, then rebind all VSPs at once
+	for v in $vsps; do
+		unbind_vsp $v;
+	done
+	for v in $vsps; do
+		bind_vsp $v;
+	done;
+
+	# Perform a simple copy test to validate HW is alive
+	test_copy RGB24 128x128
+}
+
+test_init $0 "$features"
+test_run