* Copyright (C) 2004 Imendio HB
*
* Licensed under the Academic Free License version 2.1
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
+#include <config.h>
#include "dispatch.h"
#include "connection.h"
#include "driver.h"
#include <unistd.h>
#endif
+#ifndef TEST_CONNECTION
+/*
+ TODO autotools:
+ move to build system as already done for cmake
+*/
+#ifdef DBUS_UNIX
+#define TEST_CONNECTION "debug-pipe:name=test-server"
+#else
+#define TEST_CONNECTION "tcp:host=localhost,port=1234"
+#endif
+#endif
+
static dbus_bool_t
send_one_message (DBusConnection *connection,
BusContext *context,
message,
NULL))
return TRUE; /* silently don't send it */
-
+
+ if (dbus_message_contains_unix_fds(message) &&
+ !dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
+ return TRUE; /* silently don't send it */
+
if (!bus_transaction_send (transaction,
connection,
message))
_dbus_assert (sender == NULL || bus_connection_is_active (sender));
_dbus_assert (dbus_message_get_sender (message) != NULL);
+ context = bus_transaction_get_context (transaction);
+
+ /* First, send the message to the addressed_recipient, if there is one. */
+ if (addressed_recipient != NULL)
+ {
+ if (!bus_context_check_security_policy (context, transaction,
+ sender, addressed_recipient,
+ addressed_recipient,
+ message, error))
+ return FALSE;
+
+ if (dbus_message_contains_unix_fds (message) &&
+ !dbus_connection_can_send_type (addressed_recipient,
+ DBUS_TYPE_UNIX_FD))
+ {
+ dbus_set_error (error,
+ DBUS_ERROR_NOT_SUPPORTED,
+ "Tried to send message with Unix file descriptors"
+ "to a client that doesn't support that.");
+ return FALSE;
+ }
+
+ /* Dispatch the message */
+ if (!bus_transaction_send (transaction, addressed_recipient, message))
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+ }
+
+ /* Now dispatch to others who look interested in this message */
connections = bus_transaction_get_connections (transaction);
-
dbus_error_init (&tmp_error);
- context = bus_transaction_get_context (transaction);
matchmaker = bus_context_get_matchmaker (context);
recipients = NULL;
}
_dbus_list_clear (&recipients);
-
+
if (dbus_error_is_set (&tmp_error))
{
dbus_move_error (&tmp_error, error);
BusContext *context;
DBusHandlerResult result;
DBusConnection *addressed_recipient;
-
+
result = DBUS_HANDLER_RESULT_HANDLED;
-
+
transaction = NULL;
addressed_recipient = NULL;
dbus_error_init (&error);
-
+
context = bus_connection_get_context (connection);
_dbus_assert (context != NULL);
-
+
/* If we can't even allocate an OOM error, we just go to sleep
* until we can.
*/
while (!bus_connection_preallocate_oom_error (connection))
_dbus_wait_for_memory ();
-
+
/* Ref connection in case we disconnect it at some point in here */
dbus_connection_ref (connection);
-
+
service_name = dbus_message_get_destination (message);
#ifdef DBUS_ENABLE_VERBOSE_MODE
interface_name = dbus_message_get_interface (message);
member_name = dbus_message_get_member (message);
error_name = dbus_message_get_error_name (message);
-
+
_dbus_verbose ("DISPATCH: %s %s %s to %s\n",
interface_name ? interface_name : "(no interface)",
member_name ? member_name : "(no member)",
service_name ? service_name : "peer");
}
#endif /* DBUS_ENABLE_VERBOSE_MODE */
-
+
/* If service_name is NULL, if it's a signal we send it to all
* connections with a match rule. If it's not a signal, there
* are some special cases here but mostly we just bail out.
goto out;
}
}
-
+
/* Create our transaction */
transaction = bus_transaction_new (context);
if (transaction == NULL)
BUS_SET_OOM (&error);
goto out;
}
-
+
/* Assign a sender to the message */
if (bus_connection_is_active (connection))
{
*/
service_name = dbus_message_get_destination (message);
}
-
+
if (service_name &&
strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */
{
BusRegistry *registry;
_dbus_assert (service_name != NULL);
-
+
registry = bus_connection_get_registry (connection);
-
+
_dbus_string_init_const (&service_string, service_name);
service = bus_registry_lookup (registry, &service_string);
_dbus_verbose ("bus_activation_activate_service() failed: %s\n", error.name);
goto out;
}
-
+
goto out;
}
else if (service == NULL)
{
addressed_recipient = bus_service_get_primary_owners_connection (service);
_dbus_assert (addressed_recipient != NULL);
-
- if (!bus_context_check_security_policy (context, transaction,
- connection, addressed_recipient,
- addressed_recipient,
- message, &error))
- goto out;
-
- /* Dispatch the message */
- if (!bus_transaction_send (transaction, addressed_recipient, message))
- {
- BUS_SET_OOM (&error);
- goto out;
- }
}
}
- /* Now match the messages against any match rules, which will send
- * out signals and such. addressed_recipient may == NULL.
+ /* Now send the message to its destination (or not, if
+ * addressed_recipient == NULL), and match it against other connections'
+ * match rules.
*/
if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error))
goto out;
-
+
out:
if (dbus_error_is_set (&error))
{
&error, message))
{
bus_connection_send_oom_error (connection, message);
-
+
/* cancel transaction due to OOM */
if (transaction != NULL)
{
}
}
}
-
-
+
+
dbus_error_free (&error);
}
dbus_bool_t
bus_dispatch_add_connection (DBusConnection *connection)
-{
+{
if (!dbus_connection_add_filter (connection,
bus_dispatch_message_filter,
NULL, NULL))
return FALSE;
-
+
return TRUE;
}
const char *what_is_expected)
{
_dbus_verbose ("expecting: %s\n", what_is_expected);
-
+
while (dbus_connection_get_dispatch_status (connection) ==
DBUS_DISPATCH_COMPLETE &&
dbus_connection_get_is_connected (connection))
DBusError error;
const char *service_name, *old_owner, *new_owner;
- if (d->expected_kind == SERVICE_CREATED
+ if (d->expected_kind == SERVICE_CREATED
&& connection == d->skip_connection)
return TRUE;
dbus_error_init (&error);
d->failed = TRUE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
{
dbus_error_free (&error);
- _dbus_wait_for_memory ();
+ _dbus_wait_for_memory ();
goto reget_service_info_data;
}
else
goto out;
}
- if (*service_name == ':' && new_owner[0]
+ if (*service_name == ':' && new_owner[0]
&& strcmp (service_name, new_owner) != 0)
{
_dbus_warn ("inconsistent ServiceOwnedChanged message (\"%s\" [ %s -> %s ])\n",
}
d->failed = FALSE;
-
+
out:
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
CheckServiceOwnerChangedData socd;
_dbus_verbose ("killing connection %p\n", connection);
-
+
s = dbus_bus_get_unique_name (connection);
_dbus_assert (s != NULL);
_dbus_wait_for_memory ();
dbus_connection_ref (connection);
-
+
/* kick in the disconnect handler that unrefs the connection */
dbus_connection_close (connection);
bus_test_run_everything (context);
-
+
_dbus_assert (bus_test_client_listed (connection));
-
+
/* Run disconnect handler in test.c */
if (bus_connection_dispatch_one_message (connection))
_dbus_assert_not_reached ("something received on connection being killed other than the disconnect");
-
+
_dbus_assert (!dbus_connection_get_is_connected (connection));
dbus_connection_unref (connection);
connection = NULL;
_dbus_assert (!bus_test_client_listed (connection));
-
+
socd.expected_kind = SERVICE_DELETED;
socd.expected_service_name = base_service;
socd.failed = FALSE;
socd.skip_connection = NULL;
-
+
bus_test_clients_foreach (check_service_owner_changed_foreach,
&socd);
dbus_free (base_service);
-
+
if (socd.failed)
_dbus_assert_not_reached ("didn't get the expected NameOwnerChanged (deletion) messages");
-
+
if (!check_no_leftovers (context))
_dbus_assert_not_reached ("stuff left in message queues after disconnecting a client");
}
{
/* This kills the connection without expecting it to affect
* the rest of the bus.
- */
+ */
_dbus_verbose ("Unchecked kill of connection %p\n", connection);
dbus_connection_ref (connection);
nmd.failed = FALSE;
bus_test_clients_foreach (check_no_messages_foreach,
&nmd);
-
+
if (nmd.failed)
{
- _dbus_verbose ("%s: leftover message found\n",
- _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("leftover message found\n");
return FALSE;
}
else
name_message = NULL;
_dbus_verbose ("check_hello_message for %p\n", connection);
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
return TRUE;
dbus_connection_ref (connection); /* because we may get disconnected */
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
}
_dbus_assert (dbus_message_has_signature (message, ""));
-
+
dbus_message_unref (message);
message = NULL;
if (!dbus_connection_get_is_connected (connection))
{
_dbus_verbose ("connection was disconnected (presumably auth failed)\n");
-
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
-
+
/* send our message */
bus_test_run_clients_loop (SEND_PENDING (connection));
if (!dbus_connection_get_is_connected (connection))
{
_dbus_verbose ("connection was disconnected (presumably auth failed)\n");
-
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
-
+
block_connection_until_message_from_bus (context, connection, "reply to Hello");
if (!dbus_connection_get_is_connected (connection))
{
_dbus_verbose ("connection was disconnected (presumably auth failed)\n");
-
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
dbus_connection_unref (connection);
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
{
if (dbus_message_is_error (message,
else
{
CheckServiceOwnerChangedData socd;
-
+
if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
{
; /* good, expected */
while (!dbus_bus_set_unique_name (connection, name))
_dbus_wait_for_memory ();
-
+
socd.expected_kind = SERVICE_CREATED;
socd.expected_service_name = name;
socd.failed = FALSE;
socd.skip_connection = connection; /* we haven't done AddMatch so won't get it ourselves */
bus_test_clients_foreach (check_service_owner_changed_foreach,
&socd);
-
+
if (socd.failed)
goto out;
"NameAcquired");
goto out;
}
-
+
retry_get_acquired_name:
if (!dbus_message_get_args (message, &error,
DBUS_TYPE_STRING, &acquired,
if (!check_no_leftovers (context))
goto out;
-
+
retval = TRUE;
-
+
out:
- _dbus_verbose ("ending %s retval = %d\n", _DBUS_FUNCTION_NAME, retval);
-
+ _dbus_verbose ("ending - retval = %d\n", retval);
+
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
if (name_message)
dbus_message_unref (name_message);
-
+
return retval;
}
message = NULL;
_dbus_verbose ("check_double_hello_message for %p\n", connection);
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
if (message == NULL)
return TRUE;
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
-
+ _dbus_verbose ("connection was disconnected\n");
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
dbus_connection_unref (connection);
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
{
warn_unexpected (connection, message, "method return for Hello");
if (!check_no_leftovers (context))
goto out;
-
+
retval = TRUE;
-
+
out:
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
-
+
return retval;
}
message = NULL;
_dbus_verbose ("check_get_connection_unix_user for %p\n", connection);
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
base_service_name = dbus_bus_get_unique_name (connection);
- if (!dbus_message_append_args (message,
+ if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, &base_service_name,
DBUS_TYPE_INVALID))
{
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
-
+ _dbus_verbose ("connection was disconnected\n");
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
out:
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
-
+
return retval;
}
message = NULL;
_dbus_verbose ("check_get_connection_unix_process_id for %p\n", connection);
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
base_service_name = dbus_bus_get_unique_name (connection);
- if (!dbus_message_append_args (message,
+ if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, &base_service_name,
DBUS_TYPE_INVALID))
{
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
-
+ _dbus_verbose ("connection was disconnected\n");
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
*/
_dbus_verbose ("Windows correctly does not support GetConnectionUnixProcessID\n");
}
-#endif
+#endif
else
{
warn_unexpected (connection, message, "not this error");
-
+
goto out;
}
}
#ifdef DBUS_WIN
warn_unexpected (connection, message, "GetConnectionUnixProcessID to fail on Windows");
goto out;
-#else
+#else
if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
{
; /* good, expected */
out:
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
-
+
return retval;
}
message = NULL;
_dbus_verbose ("check_add_match_all for %p\n", connection);
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
dbus_message_unref (message);
return TRUE;
}
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
message = NULL;
dbus_connection_ref (connection); /* because we may get disconnected */
-
+
/* send our message */
bus_test_run_clients_loop (SEND_PENDING (connection));
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
-
+ _dbus_verbose ("connection was disconnected\n");
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
-
+
block_connection_until_message_from_bus (context, connection, "reply to AddMatch");
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
-
+ _dbus_verbose ("connection was disconnected\n");
+
dbus_connection_unref (connection);
-
+
return TRUE;
}
dbus_connection_unref (connection);
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
{
if (dbus_message_is_error (message,
if (!check_no_leftovers (context))
goto out;
-
+
retval = TRUE;
-
+
out:
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
-
+
return retval;
}
dbus_error_init (&error);
- connection = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+ connection = dbus_connection_open_private (TEST_CONNECTION, &error);
if (connection == NULL)
{
_DBUS_ASSERT_ERROR_IS_SET (&error);
}
spin_connection_until_authenticated (context, connection);
-
+
if (!check_hello_message (context, connection))
return FALSE;
-
+
if (dbus_bus_get_unique_name (connection) == NULL)
{
/* We didn't successfully register, so we can't
{
if (!check_add_match_all (context, connection))
return FALSE;
-
+
kill_client_connection (context, connection);
}
dbus_bool_t retval;
const char *nonexistent = NONEXISTENT_SERVICE_NAME;
dbus_uint32_t flags;
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"StartServiceByName");
-
+
if (message == NULL)
return TRUE;
dbus_message_set_auto_start (message, FALSE);
-
+
flags = 0;
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, &nonexistent,
dbus_message_unref (message);
return TRUE;
}
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
DBusMessage *message;
dbus_uint32_t serial;
dbus_bool_t retval;
-
+
message = dbus_message_new_method_call (NONEXISTENT_SERVICE_NAME,
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Echo");
-
+
if (message == NULL)
return TRUE;
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
dbus_bool_t retval;
DBusError error;
const char *base_service, *base_service_from_bus, *old_owner;
-
+
retval = FALSE;
-
+
dbus_error_init (&error);
base_service = NULL;
old_owner = NULL;
base_service_from_bus = NULL;
message = initial_message;
- dbus_message_ref (message);
+ dbus_message_ref (message);
if (dbus_message_is_signal (message,
DBUS_INTERFACE_DBUS,
base_service);
goto out;
}
-
+
if (strcmp (base_service, base_service_from_bus) != 0)
{
_dbus_warn ("Expected base service activation, got \"%s\" instead with owner \"%s\"\n",
old_owner);
goto out;
}
-
+
socd.expected_kind = SERVICE_CREATED;
socd.expected_service_name = base_service;
socd.failed = FALSE;
socd.skip_connection = connection;
bus_test_clients_foreach (check_service_owner_changed_foreach,
&socd);
-
+
if (socd.failed)
goto out;
}
*base_service_p = base_service;
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
dbus_bool_t retval;
DBusError error;
dbus_uint32_t activation_result;
-
+
retval = FALSE;
-
+
dbus_error_init (&error);
message = initial_message;
socd.expected_service_name = service_name;
bus_test_clients_foreach (check_service_owner_changed_foreach,
&socd);
-
+
if (socd.failed)
goto out;
-
+
dbus_message_unref (message);
service_name = NULL;
old_owner = NULL;
base_service_from_bus = NULL;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
else
{
warn_unexpected (connection, message, "NameOwnerChanged for the activated name");
-
+
goto out;
}
-
+
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN)
{
warn_unexpected (connection, message, "reply to StartServiceByName");
dbus_message_unref (message);
message = NULL;
-
+
if (!check_no_leftovers (context))
{
_dbus_warn ("Messages were left over after verifying existent activation results\n");
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
dbus_error_free (&error);
-
+
return retval;
}
DBusMessage *message;
dbus_bool_t retval;
DBusError error;
-
+
retval = FALSE;
-
+
dbus_error_init (&error);
message = initial_message;
{
const char *service_name;
CheckServiceOwnerChangedData socd;
-
+
reget_service_name_arg:
if (!dbus_message_get_args (message, &error,
DBUS_TYPE_STRING, &service_name,
goto out;
}
}
-
+
if (strcmp (service_name, activated_name) != 0)
{
_dbus_warn ("Expected to see service %s created, saw %s instead\n",
activated_name, service_name);
goto out;
}
-
+
socd.expected_kind = SERVICE_CREATED;
socd.expected_service_name = service_name;
socd.failed = FALSE;
- socd.skip_connection = connection;
+ socd.skip_connection = connection;
bus_test_clients_foreach (check_service_owner_changed_foreach,
&socd);
-
+
if (socd.failed)
goto out;
-
+
/* Note that this differs from regular activation in that we don't get a
* reply to ActivateService here.
*/
-
+
dbus_message_unref (message);
message = NULL;
service_name = NULL;
else
{
warn_unexpected (connection, message, "NameOwnerChanged for the activated name");
-
+
goto out;
}
-
+
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
CheckServiceOwnerChangedData socd;
retval = FALSE;
-
+
/* Now we are expecting ServiceOwnerChanged (deletion) messages for the base
* service and the activated_name. The base service
* notification is required to come last.
socd.failed = FALSE;
socd.skip_connection = NULL;
bus_test_clients_foreach (check_service_owner_changed_foreach,
- &socd);
+ &socd);
if (socd.failed)
goto out;
-
+
socd.expected_kind = SERVICE_DELETED;
socd.expected_service_name = base_service;
socd.failed = FALSE;
goto out;
retval = TRUE;
-
+
out:
return retval;
}
DBusMessage *message;
dbus_uint32_t serial;
dbus_bool_t retval;
-
+
_dbus_verbose ("Sending exit message to the test service\n");
retval = FALSE;
-
+
/* Kill off the test service by sending it a quit message */
message = dbus_message_new_method_call (service_name,
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Exit");
-
+
if (message == NULL)
{
/* Do this again; we still need the service to exit... */
if (!check_send_exit_to_service (context, connection,
service_name, base_service))
goto out;
-
+
return TRUE;
}
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!check_send_exit_to_service (context, connection,
service_name, base_service))
goto out;
-
+
return TRUE;
}
dbus_connection_return_message (connection, message);
message = NULL;
}
-
+
if (!got_error)
{
/* If no error, wait for the test service to exit */
block_connection_until_message_from_bus (context, connection, "test service to exit");
-
+
bus_test_run_everything (context);
}
"error with the correct reply serial");
goto out;
}
-
+
if (!dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
* stuff.
*/
message = pop_message_waiting_for_memory (connection);
-
+
if (message == NULL)
{
warn_unexpected (connection, NULL,
"error with the correct reply serial");
goto out;
}
-
+
_dbus_verbose ("Got error %s after test service exited\n",
dbus_message_get_error_name (message));
-
+
if (!check_no_leftovers (context))
{
_dbus_warn ("Messages were left over after %s\n",
goto out;
}
}
-
+
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
va_list ap;
dbus_bool_t error_found;
const char *error_name;
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
-
+
typedef enum
-{
+{
GOT_SERVICE_CREATED,
GOT_SERVICE_DELETED,
GOT_ERROR,
- GOT_SOMETHING_ELSE
+ GOT_SOMETHING_ELSE
} GotServiceInfo;
static GotServiceInfo
dbus_uint32_t flags;
base_service_message = NULL;
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
return TRUE;
dbus_message_set_auto_start (message, FALSE);
-
+
flags = 0;
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, &existent,
dbus_message_unref (message);
return TRUE;
}
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
else
{
GotServiceInfo message_kind;
-
+
if (!check_base_service_activated (context, connection,
message, &base_service))
goto out;
/* We may need to block here for the test service to exit or finish up */
block_connection_until_message_from_bus (context, connection, "test service to exit or finish up");
-
+
message = dbus_connection_borrow_message (connection);
if (message == NULL)
{
socd.expected_service_name = base_service;
socd.failed = FALSE;
socd.skip_connection = NULL;
-
+
bus_test_clients_foreach (check_service_owner_changed_foreach,
&socd);
if (message_kind != GOT_ERROR)
{
block_connection_until_message_from_bus (context, connection, "error about service exiting");
-
+
/* and process everything again */
bus_test_run_everything (context);
-
+
if (!check_got_error (context, connection,
DBUS_ERROR_SPAWN_CHILD_EXITED,
DBUS_ERROR_NO_MEMORY,
"should have been a NameOwnerChanged (creation)\n");
goto out;
}
-
+
if (!check_service_activated (context, connection, EXISTENT_SERVICE_NAME,
base_service, message))
goto out;
-
+
dbus_message_unref (message);
message = NULL;
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
if (base_service_message)
dbus_message_unref (base_service_message);
-
+
return retval;
}
dbus_bool_t retval;
const char *segv_service;
dbus_uint32_t flags;
-
+
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
return TRUE;
dbus_message_set_auto_start (message, FALSE);
-
+
segv_service = "org.freedesktop.DBus.TestSuiteSegfaultService";
flags = 0;
if (!dbus_message_append_args (message,
dbus_message_unref (message);
return TRUE;
}
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Echo");
-
+
if (message == NULL)
return TRUE;
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
#endif
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"RunHelloFromSelf");
-
+
if (message == NULL)
return TRUE;
* doesn't send a reply due to OOM.
*/
block_connection_until_message_from_bus (context, connection, "reply from running hello from self");
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_unref (message);
message = NULL;
-
+
return TRUE;
}
"/org/freedesktop/TestSuite",
"org.freedesktop.DBus.Peer",
"Ping");
-
+
if (message == NULL)
return TRUE;
* doesn't send a reply due to OOM.
*/
block_connection_until_message_from_bus (context, connection, "reply from running Ping");
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_unref (message);
message = NULL;
-
+
return TRUE;
}
DBusMessage *message;
dbus_uint32_t serial;
const char *machine_id;
-
+
message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
"/org/freedesktop/TestSuite",
"org.freedesktop.DBus.Peer",
"GetMachineId");
-
+
if (message == NULL)
return TRUE;
* doesn't send a reply due to OOM.
*/
block_connection_until_message_from_bus (context, connection, "reply from running GetMachineId");
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_unref (message);
return FALSE;
}
-
+
/* We can't check that the machine id is correct because during make check it is
* just made up for each process separately
*/
-
+
dbus_message_unref (message);
message = NULL;
-
+
return TRUE;
}
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Echo");
-
+
if (message == NULL)
return TRUE;
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_connection_return_message (connection, message);
message = NULL;
- switch (message_kind)
+ switch (message_kind)
{
case GOT_SERVICE_CREATED:
message = pop_message_waiting_for_memory (connection);
"should have been a NameOwnerChanged (creation)\n");
goto out;
}
-
+
/* Check that ServiceOwnerChanged (creation) was correctly received */
if (!check_service_auto_activated (context, connection, EXISTENT_SERVICE_NAME,
base_service, message))
goto out;
-
+
dbus_message_unref (message);
message = NULL;
* failed to register under EXISTENT_SERVICE_NAME
*/
CheckServiceOwnerChangedData socd;
-
+
socd.expected_kind = SERVICE_DELETED;
socd.expected_service_name = base_service;
socd.failed = FALSE;
* doesn't send a reply due to OOM.
*/
block_connection_until_message_from_bus (context, connection, "reply from echo message after auto-activation");
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
if (!check_existent_get_machine_id (context, connection))
goto out;
-
+
if (!check_existent_hello_from_self (context, connection))
goto out;
EXISTENT_SERVICE_NAME,
base_service))
goto out;
-
+
retval = TRUE;
out:
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Echo");
-
+
if (message == NULL)
return TRUE;
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_warn ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_warn ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_warn ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_warn ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_warn ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_warn ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Echo");
-
+
if (message == NULL)
return TRUE;
-
+
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
-
+
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_message_get_sender (message) : "(none)");
goto out;
}
-
+
if (dbus_message_is_error (message,
DBUS_ERROR_NO_MEMORY))
{
}
retval = TRUE;
-
+
out:
if (message)
dbus_message_unref (message);
-
+
return retval;
}
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Echo");
-
+
if (message == NULL)
return TRUE;
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
retval = FALSE;
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
dbus_connection_return_message (connection, message);
message = NULL;
- switch (message_kind)
+ switch (message_kind)
{
case GOT_SERVICE_CREATED:
message = pop_message_waiting_for_memory (connection);
"should have been a NameOwnerChanged (creation)\n");
goto out;
}
-
+
/* Check that ServiceOwnerChanged (creation) was correctly received */
if (!check_service_auto_activated (context, connection, SHELL_SUCCESS_SERVICE_NAME,
base_service, message))
goto out;
-
+
dbus_message_unref (message);
message = NULL;
* failed to register under SHELL_SUCCESS_SERVICE_NAME
*/
CheckServiceOwnerChangedData socd;
-
+
socd.expected_kind = SERVICE_DELETED;
socd.expected_service_name = base_service;
socd.failed = FALSE;
* doesn't send a reply due to OOM.
*/
block_connection_until_message_from_bus (context, connection, "reply from echo message after auto-activation");
-
+
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
}
if (!dbus_message_get_args (message, NULL,
- DBUS_TYPE_STRING, &argv[0],
+ DBUS_TYPE_STRING, &argv[0],
DBUS_TYPE_STRING, &argv[1],
DBUS_TYPE_STRING, &argv[2],
DBUS_TYPE_STRING, &argv[3],
goto out;
}
- /* don't worry about arg[0] as it may be different
+ /* don't worry about arg[0] as it may be different
depending on the path to the tests
*/
if (strcmp("-test", argv[1]) != 0)
{
- _dbus_warn ("Unexpected argv[1] in shell success service test (expected: %s, got: %s)\n",
+ _dbus_warn ("Unexpected argv[1] in shell success service test (expected: %s, got: %s)\n",
"-test", argv[1]);
goto out;
- }
+ }
if (strcmp("that", argv[2]) != 0)
{
- _dbus_warn ("Unexpected argv[2] in shell success service test (expected: %s, got: %s)\n",
+ _dbus_warn ("Unexpected argv[2] in shell success service test (expected: %s, got: %s)\n",
"that", argv[2]);
goto out;
- }
+ }
if (strcmp("we get", argv[3]) != 0)
{
- _dbus_warn ("Unexpected argv[3] in shell success service test (expected: %s, got: %s)\n",
+ _dbus_warn ("Unexpected argv[3] in shell success service test (expected: %s, got: %s)\n",
"we get", argv[3]);
goto out;
- }
-
+ }
+
if (strcmp("back", argv[4]) != 0)
{
- _dbus_warn ("Unexpected argv[4] in shell success service test (expected: %s, got: %s)\n",
+ _dbus_warn ("Unexpected argv[4] in shell success service test (expected: %s, got: %s)\n",
"back", argv[4]);
goto out;
- }
+ }
if (strcmp("--what", argv[5]) != 0)
{
- _dbus_warn ("Unexpected argv[5] in shell success service test (expected: %s, got: %s)\n",
+ _dbus_warn ("Unexpected argv[5] in shell success service test (expected: %s, got: %s)\n",
"--what", argv[5]);
goto out;
- }
+ }
if (strcmp("we put in", argv[6]) != 0)
{
- _dbus_warn ("Unexpected argv[6] in shell success service test (expected: %s, got: %s)\n",
+ _dbus_warn ("Unexpected argv[6] in shell success service test (expected: %s, got: %s)\n",
"we put in", argv[6]);
goto out;
- }
+ }
dbus_message_unref (message);
message = NULL;
-
+
if (!check_send_exit_to_service (context, connection,
SHELL_SUCCESS_SERVICE_NAME,
base_service))
goto out;
-
+
retval = TRUE;
out:
if (! (* d->func) (d->context))
return FALSE;
-
+
if (!check_no_leftovers (d->context))
{
_dbus_warn ("Messages were left over, should be covered by test suite\n");
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
dbus_connection_unref (connection);
*len = l;
}
}
-
+
if (!check_no_leftovers (context))
goto out;
-
+
retval = TRUE;
-
+
out:
dbus_error_free (&error);
-
+
if (message)
dbus_message_unref (message);
if (!_dbus_string_array_contains ((const char **)services, existent))
{
_dbus_warn ("Did not get the expected %s from ListActivatableNames\n", existent);
+ dbus_free_string_array (services);
return FALSE;
}
if (!dbus_connection_get_is_connected (connection))
{
- _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("connection was disconnected\n");
return TRUE;
}
"should have been a NameOwnerChanged (creation)\n");
goto out;
}
-
+
if (!check_service_activated (context, connection, EXISTENT_SERVICE_NAME,
base_service, message))
goto out;
break;
}
}
-
+
if (!check_get_services (context, connection, "ListNames", &services, &len))
{
return TRUE;
if (! (* d->func) (d->context, d->connection))
return FALSE;
-
+
if (!check_no_leftovers (d->context))
{
_dbus_warn ("Messages were left over, should be covered by test suite\n");
d.func = func;
d.context = context;
d.connection = connection;
-
+
if (!_dbus_test_oom_handling (description, check_oom_check2_func,
&d))
{
{
_dbus_string_free (&full);
return FALSE;
- }
+ }
_dbus_string_init_const (&file, filename);
-
+
if (!_dbus_concat_dir_and_file (&full, &file))
{
_dbus_string_free (&full);
return FALSE;
}
- _dbus_verbose ("Setting TEST_LAUNCH_HELPER_CONFIG to '%s'\n",
+ _dbus_verbose ("Setting TEST_LAUNCH_HELPER_CONFIG to '%s'\n",
_dbus_string_get_const_data (&full));
-
+
_dbus_setenv ("TEST_LAUNCH_HELPER_CONFIG", _dbus_string_get_const_data (&full));
_dbus_string_free (&full);
_dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
dbus_error_init (&error);
-
+
context = bus_context_new_test (test_data_dir, filename);
if (context == NULL)
return FALSE;
-
- foo = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+
+ foo = dbus_connection_open_private (TEST_CONNECTION, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_assert_not_reached ("could not set up connection");
spin_connection_until_authenticated (context, foo);
-
+
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
if (!check_add_match_all (context, foo))
_dbus_assert_not_reached ("AddMatch message failed");
-
- bar = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+
+ bar = dbus_connection_open_private (TEST_CONNECTION, &error);
if (bar == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_assert_not_reached ("could not set up connection");
spin_connection_until_authenticated (context, bar);
-
+
if (!check_hello_message (context, bar))
_dbus_assert_not_reached ("hello message failed");
if (!check_add_match_all (context, bar))
_dbus_assert_not_reached ("AddMatch message failed");
-
- baz = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+
+ baz = dbus_connection_open_private (TEST_CONNECTION, &error);
if (baz == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_assert_not_reached ("could not set up connection");
spin_connection_until_authenticated (context, baz);
-
+
if (!check_hello_message (context, baz))
_dbus_assert_not_reached ("hello message failed");
if (!check_add_match_all (context, baz))
_dbus_assert_not_reached ("AddMatch message failed");
+#ifdef DBUS_WIN_FIXME
+ _dbus_warn("TODO: testing of GetConnectionUnixUser message skipped for now\n");
+ _dbus_warn("TODO: testing of GetConnectionUnixProcessID message skipped for now\n");
+#else
if (!check_get_connection_unix_user (context, baz))
_dbus_assert_not_reached ("GetConnectionUnixUser message failed");
if (!check_get_connection_unix_process_id (context, baz))
_dbus_assert_not_reached ("GetConnectionUnixProcessID message failed");
+#endif
if (!check_list_services (context, baz))
_dbus_assert_not_reached ("ListActivatableNames message failed");
-
+
if (!check_no_leftovers (context))
{
_dbus_warn ("Messages were left over after setting up initial connections\n");
_dbus_assert_not_reached ("initial connection setup failed");
}
-
+
check1_try_iterations (context, "create_and_hello",
check_hello_connection);
-
+
check2_try_iterations (context, foo, "nonexistent_service_no_auto_start",
check_nonexistent_service_no_auto_start);
check2_try_iterations (context, foo, "segfault_service_no_auto_start",
check_segfault_service_no_auto_start);
#endif
-
+
check2_try_iterations (context, foo, "existent_service_no_auto_start",
check_existent_service_no_auto_start);
-
+
check2_try_iterations (context, foo, "nonexistent_service_auto_start",
check_nonexistent_service_auto_start);
-
-#ifdef DBUS_WIN_FIXME
+
+#ifdef DBUS_WIN_FIXME
_dbus_warn("TODO: dispatch.c segfault_service_auto_start test\n");
#else
/* only do the segfault test if we are not using the launcher */
check2_try_iterations (context, foo, "existent_service_auto_auto_start",
check_existent_service_auto_start);
#endif
-
+
if (!check_existent_service_auto_start (context, foo))
_dbus_assert_not_reached ("existent service auto start failed");
kill_client_connection_unchecked (baz);
bus_context_unref (context);
-
+
return TRUE;
}
/* save the config name for the activation helper */
if (!setenv_TEST_LAUNCH_HELPER_CONFIG (test_data_dir, filename))
_dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
-
+
dbus_error_init (&error);
-
+
context = bus_context_new_test (test_data_dir, filename);
if (context == NULL)
return FALSE;
-
- foo = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+
+ foo = dbus_connection_open_private (TEST_CONNECTION, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
kill_client_connection_unchecked (foo);
bus_context_unref (context);
-
+
return TRUE;
}
"valid-config-files/debug-allow-all.conf", FALSE))
return FALSE;
+#ifdef DBUS_WIN
+ _dbus_warn("Info: Launch helper activation tests skipped because launch-helper is not supported yet\n");
+#else
/* run launch-helper activation tests */
_dbus_verbose ("Launch helper activation tests\n");
if (!bus_dispatch_test_conf (test_data_dir,
if (!bus_dispatch_test_conf_fail (test_data_dir,
"valid-config-files-system/debug-allow-all-fail.conf"))
return FALSE;
+#endif
return TRUE;
}
DBusError error;
dbus_error_init (&error);
-
+
/* Test SHA1 authentication */
_dbus_verbose ("Testing SHA1 context\n");
-
+
context = bus_context_new_test (test_data_dir,
"valid-config-files/debug-allow-all-sha1.conf");
if (context == NULL)
return FALSE;
- foo = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+ foo = dbus_connection_open_private (TEST_CONNECTION, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_assert_not_reached ("could not set up connection");
spin_connection_until_authenticated (context, foo);
-
+
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
if (!check_add_match_all (context, foo))
_dbus_assert_not_reached ("addmatch message failed");
-
+
if (!check_no_leftovers (context))
{
_dbus_warn ("Messages were left over after setting up initial SHA-1 connection\n");
_dbus_assert_not_reached ("initial connection setup failed");
}
-
+
check1_try_iterations (context, "create_and_hello_sha1",
check_hello_connection);
if (context == NULL)
_dbus_assert_not_reached ("could not alloc context");
- foo = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+ foo = dbus_connection_open_private (TEST_CONNECTION, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
if (!check_add_match_all (context, foo))
_dbus_assert_not_reached ("AddMatch message failed");
- bar = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
+ bar = dbus_connection_open_private (TEST_CONNECTION, &error);
if (bar == NULL)
_dbus_assert_not_reached ("could not alloc connection");