mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-10 18:43:42 +01:00
gtestutils: Ensure test subprocesses don't dump core
Since we expect them to crash, let's not spam the system core dump collection (systemd, abrt). At the moment systemd is not very robust against programs crashing in loops. Instead of aborting, we exit(1). https://bugzilla.gnome.org/show_bug.cgi?id=700714
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtestutils.h"
|
||||
#include "gmessages-private.h"
|
||||
#include "gfileutils.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -36,6 +37,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
@@ -54,6 +58,7 @@
|
||||
#include "gslice.h"
|
||||
#include "gspawn.h"
|
||||
#include "glib-private.h"
|
||||
#include "gmessages-private.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -759,6 +764,17 @@ parse_args (gint *argc_p,
|
||||
else if (strcmp ("--GTestSubprocess", argv[i]) == 0)
|
||||
{
|
||||
test_in_subprocess = TRUE;
|
||||
/* We typically expect these child processes to crash, and some
|
||||
* tests spawn a *lot* of them. Avoid spamming system crash
|
||||
* collection programs such as systemd-coredump and abrt.
|
||||
*/
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
{
|
||||
struct rlimit limit = { 0, 0 };
|
||||
(void) setrlimit (RLIMIT_CORE, &limit);
|
||||
}
|
||||
#endif
|
||||
_g_log_set_exit_on_fatal ();
|
||||
argv[i] = NULL;
|
||||
}
|
||||
else if (strcmp ("-p", argv[i]) == 0 || strncmp ("-p=", argv[i], 3) == 0)
|
||||
@@ -2027,7 +2043,7 @@ g_assertion_message (const char *domain,
|
||||
|
||||
g_test_log (G_TEST_LOG_ERROR, s, NULL, 0, NULL);
|
||||
g_free (s);
|
||||
abort();
|
||||
_g_log_abort ();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user