test: skip tests when we're not root

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Peter Hutterer 2018-02-26 17:09:48 +10:00
parent 6ff816163e
commit fbeeef9cde
2 changed files with 10 additions and 0 deletions

View file

@ -167,6 +167,11 @@ int main(int argc, char **argv)
TCase *tc;
int failed;
if (getuid() != 0) {
fprintf(stderr, "This test needs to run as root\n");
return 77;
}
s = suite_create("kernel tests");
tc = tcase_create("EVIOCREVOKE");

View file

@ -73,6 +73,11 @@ int main(void)
const struct rlimit corelimit = {0, 0};
int failed;
if (getuid() != 0) {
fprintf(stderr, "This test needs to run as root\n");
return 77;
}
if (is_debugger_attached())
setenv("CK_FORK", "no", 0);