gmarkup.c \
gmem.c \
gmessages.c \
+ gmessages-private.h \
gmirroringtable.h \
gnode.c \
goption.c \
--- /dev/null
+/* gmain.h - the GLib Main loop
+ * Copyright (C) 1998-2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __G_MESSAGES_PRIVATE_H__
+#define __G_MESSAGES_PRIVATE_H__
+
+#include <glib/gmessages.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void
+_g_log_set_exit_on_fatal (void);
+
+G_GNUC_INTERNAL void
+_g_log_abort (void) G_GNUC_NORETURN;
+
+G_END_DECLS
+
+#endif /* __G_MESSAGES_PRIVATE_H__ */
#include <locale.h>
#include <errno.h>
-#include "gmessages.h"
+#include "gmessages-private.h"
#include "glib-init.h"
#include "gbacktrace.h"
static GPrintFunc glib_print_func = NULL;
static GPrintFunc glib_printerr_func = NULL;
static GPrivate g_log_depth;
+static gboolean exit_on_fatal;
static GLogFunc default_log_func = g_log_default_handler;
static gpointer default_log_data = NULL;
static GTestLogFatalFunc fatal_log_func = NULL;
static gpointer fatal_log_data;
/* --- functions --- */
+
+void
+_g_log_abort (void)
+{
+ if (exit_on_fatal)
+ _exit (1);
+ else
+ abort ();
+}
+
#ifdef G_OS_WIN32
# include <windows.h>
static gboolean win32_keep_fatal_message = FALSE;
&& !fatal_log_func (log_domain, test_level, msg, fatal_log_data);
}
- if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal)
+ if ((test_level & G_LOG_FLAG_FATAL) && exit_on_fatal)
+ {
+ _g_log_abort ();
+ }
+ else if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal)
{
#ifdef G_OS_WIN32
if (win32_keep_fatal_message)
line,
pretty_function,
expression);
- abort ();
+ _g_log_abort ();
}
/**
gchar c;
return _g_vsnprintf (&c, 1, format, args) + 1;
}
+
+void
+_g_log_set_exit_on_fatal (void)
+{
+ exit_on_fatal = TRUE;
+}
#include "config.h"
#include "gtestutils.h"
+#include "gmessages-private.h"
#include "gfileutils.h"
#include <sys/types.h>
#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>
#include "gslice.h"
#include "gspawn.h"
#include "glib-private.h"
+#include "gmessages-private.h"
/**
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)
g_test_log (G_TEST_LOG_ERROR, s, NULL, 0, NULL);
g_free (s);
- abort();
+ _g_log_abort ();
}
void