Add helper function to check that if user 'nobody' exists or not. Note that 'nobody' should not have root privileges as it will be used to test the behavior of non-privileged user.
Signed-off-by: Misono Tomohiro <misono.tomoh...@jp.fujitsu.com> Signed-off-by: David Sterba <dste...@suse.com> --- tests/common | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/common b/tests/common index 1575ae38..16693ca7 100644 --- a/tests/common +++ b/tests/common @@ -314,6 +314,16 @@ check_global_prereq() fi } +check_testuser() +{ + id -u nobody > /dev/null 2>&1 + if [ $? -ne 0 ]; then + _not_run "Need to add user \"nobody\"" + fi + # Note that nobody should not have root privileges + # otherwise test may not run as expected +} + check_image() { local image -- 2.19.1