From: Jim Meyering Date: Tue, 1 Apr 2008 14:13:02 +0000 (+0200) Subject: root tests: Set NON_ROOT_USERNAME if not set already. X-Git-Tag: v6.11~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=504fa74e243cd258b649b3a436cf14b6d91faf91;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 078afca4dd..9e04cfad62 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'; }