Commit 0296c1fc authored by Simon McVittie's avatar Simon McVittie

test: Move _dbus_transport_unix_test() here

This requires exposing _dbus_connection_get_address() as an internal
symbol, but that seems worth it.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent d9dfe4ee
......@@ -137,6 +137,7 @@ void _dbus_connection_get_stats (DBusConnection *connection,
/* if DBUS_ENABLE_EMBEDDED_TESTS */
DBUS_PRIVATE_EXPORT
const char* _dbus_connection_get_address (DBusConnection *connection);
/* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
......
......@@ -61,9 +61,6 @@ dbus_bool_t _dbus_data_slot_test (const char *test_data_dir);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_userdb_test (const char *test_data_dir);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_transport_unix_test (const char *test_data_dir);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_memory_test (const char *test_data_dir);
......
......@@ -407,32 +407,3 @@ _dbus_transport_open_platform_specific (DBusAddressEntry *entry,
}
/** @} */
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
dbus_bool_t
_dbus_transport_unix_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
{
DBusConnection *c;
DBusError error;
dbus_bool_t ret;
const char *address;
dbus_error_init (&error);
c = dbus_connection_open ("unixexec:argv0=false,argv1=foobar,path=/bin/false", &error);
_dbus_assert (c != NULL);
_dbus_assert (!dbus_error_is_set (&error));
address = _dbus_connection_get_address (c);
_dbus_assert (address != NULL);
/* Let's see if the address got parsed, reordered and formatted correctly */
ret = strcmp (address, "unixexec:path=/bin/false,argv0=false,argv1=foobar") == 0;
dbus_connection_unref (c);
return ret;
}
#endif
......@@ -26,6 +26,7 @@
#include <config.h>
#include <dbus/dbus.h>
#include "dbus/dbus-connection-internal.h"
#include "dbus/dbus-internals.h"
#include "dbus/dbus-test.h"
#include "dbus/dbus-test-tap.h"
......@@ -318,6 +319,33 @@ _dbus_signature_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
#endif
}
#ifdef DBUS_UNIX
static dbus_bool_t
_dbus_transport_unix_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
{
DBusConnection *c;
DBusError error;
dbus_bool_t ret;
const char *address;
dbus_error_init (&error);
c = dbus_connection_open ("unixexec:argv0=false,argv1=foobar,path=/bin/false", &error);
_dbus_assert (c != NULL);
_dbus_assert (!dbus_error_is_set (&error));
address = _dbus_connection_get_address (c);
_dbus_assert (address != NULL);
/* Let's see if the address got parsed, reordered and formatted correctly */
ret = strcmp (address, "unixexec:path=/bin/false,argv0=false,argv1=foobar") == 0;
dbus_connection_unref (c);
return ret;
}
#endif
static DBusTestCase tests[] =
{
{ "string", _dbus_string_test },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment