mount, mount and their friends usually require root permission, so let's
skip these when not running as root!

-- 

Yi-yo Chiang
Software Engineer
[email protected]
From c4b658d6217aa96ed91edb969fdb9c70b12770f8 Mon Sep 17 00:00:00 2001
From: Yo Chiang <[email protected]>
Date: Mon, 1 Feb 2021 17:15:19 +0800
Subject: [PATCH 2/2] Skip mount.test if not running as root

mount, mount and their friends usually requires root permission.

Change-Id: I96501ef37c9e8d6754455a3414bb5855711f0475
---
 tests/mount.test | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/mount.test b/tests/mount.test
index 4f7a667f..9748a5a6 100644
--- a/tests/mount.test
+++ b/tests/mount.test
@@ -5,6 +5,13 @@
 
 [ -f testing.sh ] && . testing.sh
 
+if [ "$(id -u)" -ne 0 ]
+then
+  echo "$SHOWSKIP: mount (not root)"
+  return 2>/dev/null
+  exit
+fi
+
 #testing "name" "command" "result" "infile" "stdin"
 
 root_fs=`df | grep "\/$" | cut -d' ' -f1`
-- 
2.30.0.365.g02bc693789-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to