[at-spi2-core: 4/32] test/memory.c: Add assertions and diagnostics around forking




commit c90335d31745a83ebcafd95e7d8b36709f8e11f1
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Dec 3 18:55:44 2021 -0600

    test/memory.c: Add assertions and diagnostics around forking

 test/memory.c | 15 ++++++++++++---
 1 file 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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]