aboutsummaryrefslogtreecommitdiff
path: root/tests/id.test
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-11-22 13:09:50 -0800
committerRob Landley <rob@landley.net>2019-11-23 10:00:27 -0600
commitdeee4f033f190e59eedc82e73b94b6b4b97d0a6f (patch)
tree8fbed74f1376137ca4cca4e02955ea891b76880a /tests/id.test
parente028208e53fb94c7c6c2873a116f680e234784ec (diff)
downloadtoybox-deee4f033f190e59eedc82e73b94b6b4b97d0a6f.tar.gz
id.test: fix tests on Mac.
BSDs call the root group "wheel" instead. Also remove the duplicated "id id" from the progress output.
Diffstat (limited to 'tests/id.test')
-rwxr-xr-xtests/id.test25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/id.test b/tests/id.test
index 32f26191..b4b13a6e 100755
--- a/tests/id.test
+++ b/tests/id.test
@@ -4,15 +4,18 @@
#testing "name" "command" "result" "infile" "stdin"
-testing "id 0" "id 0 | sed 's/ context=.*//g'" \
- "uid=0(root) gid=0(root) groups=0(root)\n" "" ""
-testing "id root" "id root | sed 's/ context=.*//g'" \
+# Systems with SELinux will have security context cruft,
+# and BSDs call the root group "wheel" instead.
+CLEAN="sed 's/ context=.*//g' | sed 's/wheel/root/g'"
+
+testing "0" "id 0 | $CLEAN" "uid=0(root) gid=0(root) groups=0(root)\n" "" ""
+testing "root" "id root | $CLEAN" \
"uid=0(root) gid=0(root) groups=0(root)\n" "" ""
-testing "id -G root" "id -G root" "0\n" "" ""
-testing "id -nG root" "id -nG root" "root\n" "" ""
-testing "id -g root" "id -g root" "0\n" "" ""
-testing "id -ng root" "id -ng root" "root\n" "" ""
-testing "id -u root" "id -u root" "0\n" "" ""
-testing "id -nu root" "id -nu root" "root\n" "" ""
-testing "id no-such-user" "id no-such-user 2>/dev/null ; echo \$?" "1\n" "" ""
-testing "id 2147483647" "id 2147483647 2>/dev/null ; echo \$?" "1\n" "" ""
+testing "-G root" "id -G root" "0\n" "" ""
+testing "-nG root" "id -nG root | $CLEAN" "root\n" "" ""
+testing "-g root" "id -g root" "0\n" "" ""
+testing "-ng root" "id -ng root | $CLEAN" "root\n" "" ""
+testing "-u root" "id -u root" "0\n" "" ""
+testing "-nu root" "id -nu root" "root\n" "" ""
+testing "no-such-user" "id no-such-user 2>/dev/null ; echo \$?" "1\n" "" ""
+testing "2147483647" "id 2147483647 2>/dev/null ; echo \$?" "1\n" "" ""