Exemplo n.º 1
0
static void
setup (Fixture *f,
    gconstpointer context)
{
  const Config *config = context;
  gchar *address;

  f->ctx = test_main_context_get ();
  f->ge = NULL;
  dbus_error_init (&f->e);

  address = test_get_dbus_daemon (config ? config->config_file : NULL,
                                  TEST_USER_MESSAGEBUS, NULL,
                                  &f->daemon_pid);

  if (address == NULL)
    {
      f->skip = TRUE;
      return;
    }

  f->conn = test_try_connect_to_bus_as_user (f->ctx, address,
      config ? config->user : TEST_USER_ME, &f->ge);

  if (f->conn == NULL &&
      g_error_matches (f->ge, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
    {
      g_test_skip (f->ge->message);
      g_clear_error (&f->ge);
      f->skip = TRUE;
    }

  g_assert_no_error (f->ge);
  g_free (address);
}
Exemplo n.º 2
0
static void
setup (Fixture *f,
       gconstpointer context)
{
    const Config *config = context;
    gchar *address;

    f->ctx = test_main_context_get ();
    f->ge = NULL;
    dbus_error_init (&f->e);

    address = test_get_dbus_daemon (config ? config->config_file : NULL,
                                    TEST_USER_MESSAGEBUS,
                                    &f->daemon_pid);

    if (address == NULL)
    {
        f->skip = TRUE;
        return;
    }

    f->conn = test_connect_to_bus_as_user (f->ctx, address,
                                           config ? config->user : TEST_USER_ME);

    if (f->conn == NULL)
        f->skip = TRUE;

    g_free (address);
}