*/
#include "config.h"
#include "gtestutils.h"
+#include <glib.h>
#include "galias.h"
#include <sys/types.h>
#ifdef G_OS_UNIX
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
+
+/* Global variable for storing assertion messages; this is the counterpart to
+ * glibc's (private) __abort_msg variable, and allows developers and crash
+ * analysis systems like Apport and ABRT to fish out assertion messages from
+ * core dumps, instead of having to catch them on screen output. */
+char *__glib_assert_msg = NULL;
/* --- structures --- */
struct GTestCase
void *fixture;
g_test_log (G_TEST_LOG_START_CASE, test_run_name, NULL, 0, NULL);
test_run_forks = 0;
+ g_test_log_set_fatal_handler (NULL, NULL);
g_timer_start (test_run_timer);
fixture = tc->fixture_size ? g_malloc0 (tc->fixture_size) : tc->test_data;
test_run_seed (test_run_seedstr);
func, func[0] ? ":" : "",
" ", message, NULL);
g_printerr ("**\n%s\n", s);
+
+ /* store assertion message in global variable, so that it can be found in a
+ * core dump */
+ if (__glib_assert_msg != NULL)
+ /* free the old one */
+ free (__glib_assert_msg);
+ __glib_assert_msg = (char*) malloc (strlen (s) + 1);
+ strcpy (__glib_assert_msg, s);
+
g_test_log (G_TEST_LOG_ERROR, s, NULL, 0, NULL);
g_free (s);
abort();
* @str1: a C string or %NULL
* @str2: another C string or %NULL
*
- * Compares @str1 and @str2 like strcmp(). Handles %NULL strings gracefully.
+ * Compares @str1 and @str2 like strcmp(). Handles %NULL
+ * gracefully by sorting it before non-%NULL strings.
*
* Returns: -1, 0 or 1, if @str1 is <, == or > than @str2.
*