test: add LIBEVDEV_SKIP_ROOT_TESTS environment variable check
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 29 Jun 2018 01:13:44 +0000 (11:13 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 29 Jun 2018 01:15:41 +0000 (11:15 +1000)
Depending on the container, or other checks don't always work. Add an extra
environment variable instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/test-main.c

index fa4c48c..1898d0c 100644 (file)
@@ -91,6 +91,8 @@ int main(void)
 
        for (t = &__start_test_section; t < &__stop_test_section; t++) {
                if (t->needs_root_privileges) {
+                       if (getenv("LIBEVDEV_SKIP_ROOT_TESTS"))
+                               return 77;
 
                        if (getuid() != 0) {
                                fprintf(stderr, "This test needs to run as root\n");