tests: Compile the test_unix_address() test unconditionally

Just skip the test if the unix transport isn’t supported. This means we
get better compilation coverage, and more explicit TAP output saying
that the test is being skipped on unsupported platforms.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-03-15 14:25:19 +00:00
parent 264617cfb5
commit 3cd30c59e9

View File

@ -89,10 +89,12 @@ test_address_parsing (void)
assert_not_supported_address ("magic-tractor:");
}
#ifdef G_OS_UNIX
static void
test_unix_address (void)
{
#ifndef G_OS_UNIX
g_test_skip ("unix transport is not supported on non-Unix platforms");
#else
assert_is_supported_address ("unix:path=/tmp/dbus-test");
assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test");
assert_not_supported_address ("unix:foo=bar");
@ -103,8 +105,8 @@ test_unix_address (void)
assert_not_supported_address ("unix:tmpdir=/tmp,abstract=/tmp/foo");
assert_not_supported_address ("unix:path=/tmp,abstract=/tmp/foo");
assert_not_supported_address ("unix:");
}
#endif
}
static void
test_nonce_tcp_address (void)
@ -185,9 +187,7 @@ main (int argc,
g_test_add_func ("/gdbus/empty-address", test_empty_address);
g_test_add_func ("/gdbus/address-parsing", test_address_parsing);
#ifdef G_OS_UNIX
g_test_add_func ("/gdbus/unix-address", test_unix_address);
#endif
g_test_add_func ("/gdbus/nonce-tcp-address", test_nonce_tcp_address);
g_test_add_func ("/gdbus/tcp-address", test_tcp_address);
g_test_add_func ("/gdbus/autolaunch-address", test_autolaunch_address);