root tests: Set NON_ROOT_USERNAME if not set already.
authorJim Meyering <meyering@redhat.com>
Tue, 1 Apr 2008 14:13:02 +0000 (16:13 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 1 Apr 2008 14:13:02 +0000 (16:13 +0200)
* 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

index 078afca..9e04cfa 100644 (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'; }