mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-28 16:40:10 +01:00
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 <smcv@collabora.com>
This commit is contained in:
parent
d9dfe4ee3e
commit
0296c1fcbf
4 changed files with 29 additions and 32 deletions
|
|
@ -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 },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue