mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-15 20:18:05 +02:00
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>
This commit is contained in:
parent
3560c29d94
commit
73e4bc7fed
@ -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 ();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user