[PATCH libevdev] test: disable coredumps during test suite runs

Peter Hutterer peter.hutterer at who-t.net
Tue May 9 03:49:19 UTC 2017


It's a test suite, it shouldn't fill up the file system or the journal with
coredumps.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/test-main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/test-main.c b/test/test-main.c
index 83fce14..1f7f6f4 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -22,9 +22,11 @@
 
 #include <config.h>
 #include <check.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/ptrace.h>
+#include <sys/resource.h>
 #include <sys/wait.h>
 #include <libevdev/libevdev.h>
 
@@ -68,11 +70,15 @@ is_debugger_attached(void)
 
 int main(int argc, char **argv)
 {
+	const struct rlimit corelimit = {0, 0};
 	int failed;
 
 	if (is_debugger_attached())
 		setenv("CK_FORK", "no", 0);
 
+	if (setrlimit(RLIMIT_CORE, &corelimit) != 0)
+		perror("WARNING: Core dumps not disabled. Reason");
+
 	libevdev_set_log_function(test_logfunc_abort_on_error, NULL);
 
 	Suite *s = libevdev_has_event_test();
-- 
2.12.2



More information about the Input-tools mailing list