[glib/wip/smcv/gdbus-tests: 3/4] gdbus-peer test: Use unix:dir address if exact format doesn't matter



commit bab277fd50a4d44e253a38cc964c50dd0902301f
Author: Simon McVittie <smcv collabora com>
Date:   Tue Oct 29 16:18:32 2019 +0000

    gdbus-peer test: Use unix:dir address if exact format doesn't matter
    
    Previously, we used unix:tmpdir, except in tests that verify that a
    particular address type works (notably unix:dir). Now we use unix:dir
    most of the time, and unix:tmpdir gets its own test instead.
    
    This helps to ensure that the tests continue to work on non-Linux Unix
    kernels, where abstract sockets do not exist and so unix:tmpdir is
    equivalent to unix:dir, even in the common case where the developer has
    only tried the test on Linux.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 gio/tests/gdbus-peer.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index bb6304151..7887ab917 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -273,14 +273,9 @@ setup_test_address (void)
 {
   if (is_unix)
     {
-      g_test_message ("Testing with unix:tmpdir address");
-      if (g_unix_socket_address_abstract_names_supported ())
-       tmp_address = g_strdup ("unix:tmpdir=/tmp/gdbus-test-");
-      else
-       {
-         tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL);
-         tmp_address = g_strdup_printf ("unix:tmpdir=%s", tmpdir);
-       }
+      g_test_message ("Testing with unix:dir address");
+      tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL);
+      tmp_address = g_strdup_printf ("unix:dir=%s", tmpdir);
     }
   else
     tmp_address = g_strdup ("nonce-tcp:");
@@ -288,11 +283,11 @@ setup_test_address (void)
 
 #ifdef G_OS_UNIX
 static void
-setup_dir_test_address (void)
+setup_tmpdir_test_address (void)
 {
-  g_test_message ("Testing with unix:dir address");
+  g_test_message ("Testing with unix:tmpdir address");
   tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL);
-  tmp_address = g_strdup_printf ("unix:dir=%s", tmpdir);
+  tmp_address = g_strdup_printf ("unix:tmpdir=%s", tmpdir);
 }
 
 static void
@@ -1045,7 +1040,7 @@ test_peer (void)
   teardown_test_address ();
 
 #ifdef G_OS_UNIX
-  setup_dir_test_address ();
+  setup_tmpdir_test_address ();
   do_test_peer ();
   teardown_test_address ();
 


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