utils_test: Introduce verify_running_as_root()
Some tests do require admin privileges, so, when running
as a regular user and reaching one of those tests, it is
good to just skip the test instead of trying to execute
it.
Therefore, introduce a utility function to verify whether
we're running as root (actually, uid=0), and if not,
throw an exception. Also add a postprocess param, that
will throw an error if the param 'requires_root' is set.
This will also make possible to tell in the test runner
list whether a test requires root or not, making one
more useful information clear to the users.
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
Showing
想要评论请 注册 或 登录