diff options
author | Elliott Hughes <enh@google.com> | 2019-06-25 14:01:07 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-06-25 18:44:09 -0500 |
commit | fcac2a821c9b382ee265b9f1ed8a251f47c6892f (patch) | |
tree | e26c8e80060d36f067bf35a90ec3f53a771491aa /tests/chgrp.test | |
parent | ac631beb854f4d1d533819d7eefbdadbe94cec95 (diff) | |
download | toybox-fcac2a821c9b382ee265b9f1ed8a251f47c6892f.tar.gz |
Make chgrp and chown tests work on Android.
There's no /etc/passwd and /etc/group, but there are enough users and
groups that we can test with. ("bin" and "daemon" were added for LTP;
"shell" is what you get with `adb shell`.)
Diffstat (limited to 'tests/chgrp.test')
-rwxr-xr-x | tests/chgrp.test | 10 |
1 files changed, 7 insertions, 3 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 |