mirror of
https://github.com/coreutils/coreutils.git
synced 2024-12-04 07:24:22 +08:00
Renamed from root-only.
This commit is contained in:
parent
8e47db95c6
commit
273c2c5fbc
27
tests/priv-check
Normal file
27
tests/priv-check
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- sh -*-
|
||||
# Source this file at the beginning of a test that works
|
||||
# only when run as root or as non-root.
|
||||
|
||||
case $1 in
|
||||
require-root) who='as root';;
|
||||
require-non-root) who='by an unprivileged user';;
|
||||
*) echo "Usage: $0 require-root|require-non-root" 1>&2; exit 1;;
|
||||
esac
|
||||
|
||||
root_check_temp=root-check.$$
|
||||
touch $root_check_temp || framework_failure=1
|
||||
chmod a-w $root_check_temp || framework_failure=1
|
||||
|
||||
(echo foo >> $root_check_temp) >/dev/null 2>&1 || {
|
||||
cat <<EOF
|
||||
***************************
|
||||
NOTICE:
|
||||
$0: This test is being skipped, since it works only
|
||||
when run $who.
|
||||
***************************
|
||||
EOF
|
||||
rm -f $root_check_temp
|
||||
(exit 77); exit
|
||||
}
|
||||
|
||||
rm -f $root_check_temp
|
Loading…
Reference in New Issue
Block a user