aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/chgrp.test10
-rwxr-xr-xtests/chown.test17
2 files changed, 18 insertions, 9 deletions
diff --git a/tests/chgrp.test b/tests/chgrp.test
index 65820361..5c7e4258 100755
--- a/tests/chgrp.test
+++ b/tests/chgrp.test
@@ -9,9 +9,13 @@ then
exit
fi
-# We chgrp between "root" and the last group in /etc/group.
-
-GRP="$(sed -n '$s/:.*//p' /etc/group)"
+if [ -f /etc/group ]; then
+ # We chgrp between "root" and the last group in /etc/group.
+ GRP="$(sed -n '$s/:.*//p' /etc/group)"
+else
+ # Or assume we're on Android and pick a well-known group.
+ GRP=shell
+fi
# Set up a little testing hierarchy
diff --git a/tests/chown.test b/tests/chown.test
index 56eed81e..20be541a 100755
--- a/tests/chown.test
+++ b/tests/chown.test
@@ -9,11 +9,16 @@ then
exit
fi
-# We chown between user "root" and the last user in /etc/passwd,
-# and group "root" and the last group in /etc/group.
-
-USR="$(sed -n '$s/:.*//p' /etc/passwd)"
-GRP="$(sed -n '$s/:.*//p' /etc/group)"
+if [ -f /etc/group ]; then
+ # We chown between user "root" and the last user in /etc/passwd,
+ # and group "root" and the last group in /etc/group.
+ USR="$(sed -n '$s/:.*//p' /etc/passwd)"
+ GRP="$(sed -n '$s/:.*//p' /etc/group)"
+else
+ # Or we assume we're on Android...
+ USR="shell"
+ GRP="daemon"
+fi
# Set up a little testing hierarchy
@@ -24,7 +29,7 @@ F=testdir/file
# Wrapper to reset groups and return results
-OUT="&& echo \$(ls -l testdir/file | awk '{print \$3,\$4}')"
+OUT="&& stat --format '%U %G' $F"
#testing "name" "command" "result" "infile" "stdin"