Skip to contentSkip to conversation

selftests: ir: skip when non-root user runs the test

PATCH New Shuah Khan 1 participant 1 message Jan 31, 2019 Kselftest

lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

PATCH 1/1 selftests: ir: skip when non-root user runs the test

Skip instead of fail when non-root user runs the test.

Signed-off-by Shuah Khan <shuah at kernel.org>
---
 tools/testing/selftests/ir/ir_loopback.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/ir/ir_loopback.sh +5 -0
index 0a0b8dfa39be..b90dc9939f45 100755
@@ -4,6 +4,11 @@
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
+if [ $UID != 0 ]; then
+	echo "Please run ir_loopback test as root [SKIP]"
+	exit $ksft_skip
+fi
+
 if ! /sbin/modprobe -q -n rc-loopback; then
         echo "ir_loopback: module rc-loopback is not found [SKIP]"
         exit $ksft_skip
Signature · 1 line
2.17.1