[Fuego] [PATCH] busybox: skip tests which need root, if test user is not root

Wang, Mingyu wangmy at cn.fujitsu.com
Mon Jul 23 02:50:27 UTC 2018


Hi Tim,

Thank you very much for pointing out these problems. 
I will confirm the need for root permissions in other test cases.

by Wangmy.

-----Original Message-----
From: Tim.Bird at sony.com [mailto:Tim.Bird at sony.com] 
Sent: Saturday, July 21, 2018 4:42 AM
To: Wang, Mingyu/王 鸣瑜 <wangmy at cn.fujitsu.com>; fuego at lists.linuxfoundation.org
Subject: [PATCH] busybox: skip tests which need root, if test user is not root

This patch is already applied, but I'm providing it here in case you see something wrong (in which case let me know), and so people know about this capability.
---
Some busybox tests require root permissions.  If the user used by Fuego for the test is non-root, then skip these tests.

Signed-off-by: Tim Bird <tim.bird at sony.com>
---
 engine/tests/Functional.busybox/fuego_test.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/engine/tests/Functional.busybox/fuego_test.sh b/engine/tests/Functional.busybox/fuego_test.sh
index 70a6ec1..2d2e8f6 100755
--- a/engine/tests/Functional.busybox/fuego_test.sh
+++ b/engine/tests/Functional.busybox/fuego_test.sh
@@ -27,6 +27,13 @@ function skip_if_command_unavailable {
     fi
 }
 
+# $1: string with busybox test names separated by spaces function 
+skip_if_not_root {
+    if ! check_root ; then
+        skip_tests "$1"
+    fi
+}
+
 function test_pre_check {
     is_on_target_path busybox PROGRAM_BUSYBOX
     assert_define PROGRAM_BUSYBOX "Missing 'busybox' program on target board"
@@ -34,6 +41,7 @@ function test_pre_check {
     touch ${LOGDIR}/skiplist.txt
     skip_if_command_unavailable expect "busybox_ash.sh"
     skip_if_command_unavailable tr "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chmod1.sh busybox_chmod2.sh busybox_chown1.sh busybox_chown2.sh"
+    skip_if_not_root "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chown1.sh busybox_chown2.sh busybox_chroot.sh"
 }
 
 function test_deploy {
--
2.1.4







More information about the Fuego mailing list