From 916e8296f60f0bcb01b0c7fbc94648e2268a7e7c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 27 Sep 2017 13:50:11 +1000 Subject: [PATCH] test: if we're not root, return with status 77 exit code 77 signals "skip this test" Signed-off-by: Peter Hutterer --- test/litest.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/litest.c b/test/litest.c index 54fe77cb..4f26771f 100644 --- a/test/litest.c +++ b/test/litest.c @@ -3563,6 +3563,13 @@ main(int argc, char **argv) const struct rlimit corelimit = { 0, 0 }; enum litest_mode mode; + if (getuid() != 0) { + fprintf(stderr, + "%s must be run as root.\n", + program_invocation_short_name); + return 77; + } + litest_init_test_devices(); list_init(&all_tests);