Skip to content
Snippets Groups Projects
Commit 54ad67db authored by Simon McVittie's avatar Simon McVittie
Browse files

Merge branch 'wip/smcv/disable-crash-reporting' into 'master'

testutils: Add a backport of g_test_disable_crash_reporting()

See merge request GNOME/libglnx!50
parents c02eb599 30b89b83
No related branches found
No related tags found
1 merge request!584Update libglnx
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include "glnx-backport-testutils.h" #include "glnx-backport-testutils.h"
#include "glnx-backports.h" #include "glnx-backports.h"
#include <sys/prctl.h>
#include <sys/resource.h>
#if !GLIB_CHECK_VERSION (2, 68, 0) #if !GLIB_CHECK_VERSION (2, 68, 0)
/* Backport of g_assertion_message_cmpstrv() */ /* Backport of g_assertion_message_cmpstrv() */
void void
...@@ -143,3 +146,17 @@ _glnx_test_incomplete_printf (const char *format, ...@@ -143,3 +146,17 @@ _glnx_test_incomplete_printf (const char *format,
#endif #endif
} }
#endif #endif
#if !GLIB_CHECK_VERSION (2, 78, 0)
void
_glnx_test_disable_crash_reporting (void)
{
struct rlimit limit = { 0, 0 };
(void) setrlimit (RLIMIT_CORE, &limit);
/* On Linux, RLIMIT_CORE = 0 is ignored if core dumps are
* configured to be written to a pipe, but PR_SET_DUMPABLE is not. */
(void) prctl (PR_SET_DUMPABLE, 0, 0, 0, 0);
}
#endif
...@@ -201,4 +201,9 @@ void _glnx_test_skip_printf (const char *format, ...) G_GNUC_PRINTF (1, 2); ...@@ -201,4 +201,9 @@ void _glnx_test_skip_printf (const char *format, ...) G_GNUC_PRINTF (1, 2);
void _glnx_test_incomplete_printf (const char *format, ...) G_GNUC_PRINTF (1, 2); void _glnx_test_incomplete_printf (const char *format, ...) G_GNUC_PRINTF (1, 2);
#endif #endif
#if !GLIB_CHECK_VERSION (2, 78, 0)
#define g_test_disable_crash_reporting _glnx_test_disable_crash_reporting
void _glnx_test_disable_crash_reporting (void);
#endif
G_END_DECLS G_END_DECLS
...@@ -243,6 +243,7 @@ main (int argc, ...@@ -243,6 +243,7 @@ main (int argc,
} }
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_disable_crash_reporting ();
#if GLIB_CHECK_VERSION(2, 38, 0) #if GLIB_CHECK_VERSION(2, 38, 0)
g_test_set_nonfatal_assertions (); g_test_set_nonfatal_assertions ();
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment