summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-20 16:01:09 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-24 14:38:50 +0000
commit909762fd08169a600fa0b30094cc99c9ca617089 (patch)
tree41bc7262728f784b79952ceede681b3be79e8226
parentc4279c1f37b3eeae75f9f92ab2849399b039acc7 (diff)
downloaddbus-909762fd08169a600fa0b30094cc99c9ca617089.tar.gz
test_init: convert SIGALRM into SIGABRT so we leave a core dump on timeout
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89222 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
-rw-r--r--test/test-utils-glib.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c
index 6cffcb21..609f24e8 100644
--- a/test/test-utils-glib.c
+++ b/test/test-utils-glib.c
@@ -393,6 +393,14 @@ time_out (gpointer data)
return FALSE;
}
+#ifdef G_OS_UNIX
+static void
+wrap_abort (int signal)
+{
+ abort ();
+}
+#endif
+
void
test_init (int *argcp, char ***argvp)
{
@@ -409,5 +417,14 @@ test_init (int *argcp, char ***argvp)
/* The GLib main loop might not be running (we don't use it in every
* test). Die with SIGALRM shortly after if necessary. */
alarm (TIMEOUT + 10);
+
+ /* Get a core dump from the SIGALRM. */
+ {
+ struct sigaction act = { };
+
+ act.sa_handler = wrap_abort;
+
+ sigaction (SIGALRM, &act, NULL);
+ }
#endif
}