summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2021-12-03 18:55:44 -0600
committerFederico Mena Quintero <federico@gnome.org>2021-12-13 16:36:39 -0600
commitc90335d31745a83ebcafd95e7d8b36709f8e11f1 (patch)
tree72492c200fba0ff9b541fe9296f6226e7ac7650b /test
parent26f75dc00eb16ccec89561aefe15f4036d45b4ec (diff)
downloadat-spi2-core-c90335d31745a83ebcafd95e7d8b36709f8e11f1.tar.gz
test/memory.c: Add assertions and diagnostics around forking
Diffstat (limited to 'test')
-rw-r--r--test/memory.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/memory.c b/test/memory.c
index 2f53dd7f..54f06524 100644
--- a/test/memory.c
+++ b/test/memory.c
@@ -47,7 +47,7 @@ end (void *data)
static gboolean
kill_child (void *data)
{
- kill (child_pid, SIGTERM);
+ g_assert_no_errno (kill (child_pid, SIGTERM));
return FALSE;
}
@@ -56,6 +56,7 @@ on_event (AtspiEvent *event, void *data)
{
if (atspi_accessible_get_role (event->source, NULL) == ATSPI_ROLE_DESKTOP_FRAME)
{
+ printf ("memory: event: %s\n", event->type);
if (strstr (event->type, "add"))
{
AtspiAccessible *desktop = atspi_get_desktop (0);
@@ -83,8 +84,16 @@ main()
listener = atspi_event_listener_new (on_event, NULL, NULL);
atspi_event_listener_register (listener, "object:children-changed", NULL);
child_pid = fork ();
- if (!child_pid)
- execlp ("test/test-application", "test/test-application", NULL);
+ if (child_pid == 0)
+ {
+ g_assert_no_errno (execlp ("test/test-application", "test/test-application", NULL));
+ }
+ else if (child_pid == -1)
+ {
+ const char *error = g_strerror (errno);
+ g_error ("could not fork test-application child: %s", error);
+ }
+ printf ("memory: child pid: %d\n", (int) child_pid);
atspi_event_main ();
return 0;
}