diff mbox series

[v2] tests: Skip unbind/bind tests when not root

Message ID 20200918205245.58020-1-kieran.bingham@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [v2] tests: Skip unbind/bind tests when not root | expand

Commit Message

Kieran Bingham Sept. 18, 2020, 8:52 p.m. UTC
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.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
v2:
 - Provide a test_start to match the test_complete operations.


 tests/vsp-unit-test-0026.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/tests/vsp-unit-test-0026.sh b/tests/vsp-unit-test-0026.sh
index 0e013cec881b..391986e77336 100755
--- a/tests/vsp-unit-test-0026.sh
+++ b/tests/vsp-unit-test-0026.sh
@@ -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
 }