|| (d->expected_kind == OWNER_CHANGED && (!old_owner[0] || !new_owner[0]))
|| (d->expected_kind == SERVICE_DELETED && (!old_owner[0] || new_owner[0])))
{
- _dbus_warn ("inconsistent NameOwnerChanged arguments");
+ _dbus_warn ("inconsistent NameOwnerChanged arguments\n");
goto out;
}
dbus_error_init (&error);
- connection = dbus_connection_open ("debug-pipe:name=test-server", &error);
+ connection = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
if (connection == NULL)
{
_DBUS_ASSERT_ERROR_IS_SET (&error);
}
else
{
- _dbus_warn ("unexpected arguments for NameOwnerChanged message");
+ _dbus_warn ("unexpected arguments for NameOwnerChanged message\n");
message_kind = GOT_SOMETHING_ELSE;
}
}
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,
NULL))
goto out;
}
* but the correct thing may include OOM errors.
*/
static dbus_bool_t
+check_existent_get_machine_id (BusContext *context,
+ DBusConnection *connection)
+{
+ 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;
+
+ if (!dbus_connection_send (connection, message, &serial))
+ {
+ dbus_message_unref (message);
+ return TRUE;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ bus_test_run_everything (context);
+
+ /* Note: if this test is run in OOM mode, it will block when the bus
+ * 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_warn ("Failed to pop message! Should have been reply from GetMachineId message\n");
+ return FALSE;
+ }
+
+ if (dbus_message_get_reply_serial (message) != serial)
+ {
+ _dbus_warn ("Wrong reply serial\n");
+ dbus_message_unref (message);
+ return FALSE;
+ }
+
+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN)
+ {
+ _dbus_warn ("Unexpected message return during GetMachineId\n");
+ dbus_message_unref (message);
+ return FALSE;
+ }
+
+ machine_id = NULL;
+ if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &machine_id, DBUS_TYPE_INVALID))
+ {
+ _dbus_warn ("Did not get a machine ID in reply to GetMachineId\n");
+ dbus_message_unref (message);
+ return FALSE;
+ }
+
+ if (machine_id == NULL || strlen (machine_id) != 32)
+ {
+ _dbus_warn ("Machine id looks bogus: '%s'\n", machine_id ? machine_id : "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;
+}
+
+/* returns TRUE if the correct thing happens,
+ * but the correct thing may include OOM errors.
+ */
+static dbus_bool_t
check_existent_service_auto_start (BusContext *context,
DBusConnection *connection)
{
if (message == NULL)
{
_dbus_warn ("No message after auto activation "
- "(should be a service announcement)");
+ "(should be a service announcement)\n");
dbus_connection_return_message (connection, message);
message = NULL;
goto out;
if (!check_existent_ping (context, connection))
goto out;
+ if (!check_existent_get_machine_id (context, connection))
+ goto out;
+
if (!check_existent_hello_from_self (context, connection))
goto out;
if (message == NULL)
{
_dbus_warn ("No message after auto activation "
- "(should be a service announcement)");
+ "(should be a service announcement)\n");
dbus_connection_return_message (connection, message);
message = NULL;
goto out;
DBUS_TYPE_STRING, &argv[6],
DBUS_TYPE_INVALID))
{
- _dbus_warn ("Error getting arguments from return");
+ _dbus_warn ("Error getting arguments from return\n");
goto out;
}
*/
if (strcmp("-test", argv[1]) != 0)
{
- _dbus_warn ("Unexpected argv[1] in shell success service test (expected: %s, got: %s)",
+ _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)",
+ _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)",
+ _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)",
+ _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)",
+ _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)",
+ _dbus_warn ("Unexpected argv[6] in shell success service test (expected: %s, got: %s)\n",
"we put in", argv[6]);
goto out;
}
case GOT_ERROR:
case GOT_SERVICE_DELETED:
_dbus_warn ("Unexpected message after ActivateService "
- "(should be an error or a service announcement");
+ "(should be an error or a service announcement)\n");
goto out;
case GOT_SERVICE_CREATED:
if (!check_no_leftovers (d->context))
{
- _dbus_warn ("Messages were left over, should be covered by test suite");
+ _dbus_warn ("Messages were left over, should be covered by test suite\n");
return FALSE;
}
if (context == NULL)
return FALSE;
- foo = dbus_connection_open ("debug-pipe:name=test-server", &error);
+ foo = dbus_connection_open_private ("debug-pipe:name=test-server", &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 ("debug-pipe:name=test-server", &error);
+ bar = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
if (bar == NULL)
_dbus_assert_not_reached ("could not alloc connection");
if (!check_add_match_all (context, bar))
_dbus_assert_not_reached ("AddMatch message failed");
- baz = dbus_connection_open ("debug-pipe:name=test-server", &error);
+ baz = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
if (baz == NULL)
_dbus_assert_not_reached ("could not alloc connection");
if (!check_no_leftovers (context))
{
- _dbus_warn ("Messages were left over after setting up initial connections");
+ _dbus_warn ("Messages were left over after setting up initial connections\n");
_dbus_assert_not_reached ("initial connection setup failed");
}
if (context == NULL)
return FALSE;
- foo = dbus_connection_open ("debug-pipe:name=test-server", &error);
+ foo = dbus_connection_open_private ("debug-pipe:name=test-server", &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");