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.
This commit is contained in:
Jim Meyering committed 2008-04-01 16:13:02 +02:00
1 parent 157ff3506e
commit 504fa74e24
1 file changed
+6 -1
+6 -1
View File
@@ -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'; }