summaryrefslogtreecommitdiff
path: root/tests/test-lib.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-04-01 16:13:02 +0200
committerJim Meyering <meyering@redhat.com>2008-04-01 16:13:02 +0200
commit504fa74e243cd258b649b3a436cf14b6d91faf91 (patch)
treec05ae98ffe0cedd3b71ea6b9eea9522478b502f5 /tests/test-lib.sh
parent157ff3506e35a95fedcc18bd4fd6b58df0d3f544 (diff)
downloadcoreutils-504fa74e243cd258b649b3a436cf14b6d91faf91.tar.xz
root tests: Set NON_ROOT_USERNAME if not set already.
* tests/test-lib.sh (require_root_): This avoids failure of a couple of root-only tests that require a value for that envvar.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r--tests/test-lib.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 078afca4d..9e04cfad6 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -115,7 +115,12 @@ environment variable set to yes. E.g.,
fi
}
-require_root_() { uid_is_privileged_ || skip_test_ "must be run as root"; }
+require_root_()
+{
+ uid_is_privileged_ || skip_test_ "must be run as root"
+ NON_ROOT_USERNAME=${NON_ROOT_USERNAME=nobody}
+}
+
skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; }
framework_failure() { error_ 'failure in testing framework'; }