[PATCH libevdev 4/4] test: skip tests when we're not root
Peter Hutterer
peter.hutterer at who-t.net
Mon Feb 26 07:13:32 UTC 2018
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
test/test-kernel.c | 5 +++++
test/test-main.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/test/test-kernel.c b/test/test-kernel.c
index 6fba605..411306a 100644
--- a/test/test-kernel.c
+++ b/test/test-kernel.c
@@ -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");
diff --git a/test/test-main.c b/test/test-main.c
index d80806f..9a2bf94 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -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);
--
2.14.3
More information about the Input-tools
mailing list