From 504fa74e243cd258b649b3a436cf14b6d91faf91 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 1 Apr 2008 16:13:02 +0200 Subject: 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. --- tests/test-lib.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') 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'; } -- cgit v1.2.3-70-g09d2