[glib: 2/12] tests: Isolate directory access for gdbus-non-socket test




commit a3c768732dbe008f1046fdd723fa58cb83ab7dda
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Mar 11 23:56:18 2022 +0000

    tests: Isolate directory access for gdbus-non-socket test
    
    When multiple tests were run in parallel, this would race on its access
    to `~/.dbus-keyrings` to authenticate with the D-Bus server, since the
    keyring directory was not appropriately sandboxed to the unit test.
    
    Use `G_TEST_OPTION_ISOLATE_DIRS` to automatically isolate each unit
    test’s directory usage.
    
    This should hopefully fix the failure seen in
    https://gitlab.gnome.org/pwithnall/glib/-/jobs/1879558.
    ```
    228/266 glib:gio / gdbus-non-socket             FAIL     8.64 s (killed by signal 6 SIGABRT)
    …
    --- stderr ---
    GDBus-DBUS_COOKIE_SHA1: Deleted stale lock file '/home/user/.dbus-keyrings/org_gtk_gdbus_general.lock'
    **
    GLib-GIO:ERROR:../gio/tests/gdbus-non-socket.c:253:test_non_socket: assertion failed (error == NULL): 
Exhausted all available authentication mechanisms (tried: EXTERNAL, DBUS_COOKIE_SHA1) (available: EXTERNAL, 
DBUS_COOKIE_SHA1) (g-io-error-quark, 0)
    ```
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/gdbus-non-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/tests/gdbus-non-socket.c b/gio/tests/gdbus-non-socket.c
index 911aff262..7ddb55bfb 100644
--- a/gio/tests/gdbus-non-socket.c
+++ b/gio/tests/gdbus-non-socket.c
@@ -293,7 +293,7 @@ main (int   argc,
 {
   gint ret;
 
-  g_test_init (&argc, &argv, NULL);
+  g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
 
   g_test_add_func ("/gdbus/non-socket", test_non_socket);
 


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