Esempio n. 1
0
void
cut_setup(void)
{
  GError *error = NULL;
  memcached_return rc;

  tmp_directory = g_build_filename(grn_test_get_base_dir(), "tmp", NULL);
  cut_remove_path(tmp_directory, NULL);
  if (g_mkdir_with_parents(tmp_directory, 0700) == -1) {
    cut_assert_errno();
  }

  egg = gcut_egg_new(GROONGA, "-s",
                     "-p", GROONGA_TEST_PORT,
                     cut_take_printf("%s%s%s",
                                     tmp_directory,
                                     G_DIR_SEPARATOR_S,
                                     "memcached.db"),
                     NULL);
  gcut_egg_hatch(egg, &error);
  gcut_assert_error(error);

  sleep(1); /* wait for groonga daemon */
  memc = memcached_create(NULL);
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);

  servers = memcached_servers_parse("localhost:" GROONGA_TEST_PORT);
  rc = memcached_server_push(memc, servers);

  cut_set_message("memcached server connect failed.");
  cut_assert_equal_int(MEMCACHED_SUCCESS, rc);

  memcached_flush(memc, 0); /* flush immediately for debug daemon */
}
Esempio n. 2
0
void
teardown (void)
{
    mz_config_free(config);

    cut_remove_path(config_path, NULL);
}
Esempio n. 3
0
static void
teardown_database(void)
{
  grn_obj_close(&context, database);
  cut_remove_path(tmp_directory, NULL);
  g_free(tmp_directory);
}
Esempio n. 4
0
void
cut_setup(void)
{
  gchar *tmp_dir;

  sub_processes = NULL;
  base_data = NULL;

  context = g_new0(grn_ctx, 1);
  space = NULL;
  table = NULL;

#define SAVE_ENV_VALUE(var_name, macro_name)                            \
  env_ ## var_name = g_strdup(g_getenv(GRN_TEST_ENV_ ## macro_name))

  SAVE_ENV_VALUE(table_path, TABLE_PATH);
  SAVE_ENV_VALUE(table_type, TABLE_TYPE);
  SAVE_ENV_VALUE(multi_thread, MULTI_THREAD);
  SAVE_ENV_VALUE(n_processes, N_PROCESSES);
  SAVE_ENV_VALUE(process_number, PROCESS_NUMBER);

#undef SAVE_ENV_VALUE

  tmp_dir = g_build_filename(grn_test_get_build_dir(), "tmp", NULL);
  cut_remove_path(tmp_dir, NULL);

  base_dir = g_build_filename(tmp_dir, "performance", NULL);
  g_free(tmp_dir);

  g_mkdir_with_parents(base_dir, 0755);
  cut_assert_path_exist(base_dir);
}
Esempio n. 5
0
void
cut_teardown(void)
{
    if (val1) {
        free(val1);
        val1 = NULL;
    }
    if (val2) {
        free(val2);
        val2 = NULL;
    }

    if (egg) {
        g_object_unref(egg);
    }

    cut_remove_path(tmp_directory, NULL);

    if (servers) {
        memcached_server_list_free(servers);
    }
    if (memc) {
        memcached_free(memc);
    }
}
Esempio n. 6
0
void
teardown (void)
{
  if (document)
    g_object_unref (document);

  if (expected_font_names)
    gcut_list_string_free (expected_font_names);
  if (actual_font_names)
    gcut_list_string_free (actual_font_names);

  if (expected_action_types)
    g_list_free (expected_font_names);
  if (actual_action_types)
    g_list_free (actual_font_names);

  if (tmp_dir)
    g_free (tmp_dir);

  if (tmp_base_dir)
    {
      cut_remove_path (tmp_base_dir, NULL);
      g_free (tmp_base_dir);
    }
}
void
cut_setup (void)
{
    config = milter_manager_configuration_new(NULL);
    loop = milter_test_event_loop_new();

    egg = NULL;
    another_egg = NULL;
    condition = NULL;

    expected_children = milter_manager_children_new(config, loop);
    actual_children = NULL;

    expected_load_paths = NULL;

    expected_eggs = NULL;
    expected_applicable_conditions = NULL;

    actual_xml = NULL;

    tmp_dir = g_build_filename(milter_test_get_base_dir(),
                               "tmp",
                               NULL);
    cut_remove_path(tmp_dir, NULL);
    if (g_mkdir_with_parents(tmp_dir, 0700) == -1)
        cut_assert_errno();
}
Esempio n. 8
0
void
cut_teardown(void)
{
  grn_db_close(&context, database);
  grn_ctx_fin(&context);
  cut_remove_path(tmp_directory, NULL);
  g_free(path);
}
Esempio n. 9
0
void
cut_setup(void)
{
  cut_remove_path(tmp_directory, NULL);
  g_mkdir_with_parents(tmp_directory, 0700);
  path = g_build_filename(tmp_directory, "text-expr", NULL);
  grn_ctx_init(&context, 0);
  database = grn_db_create(&context, path, NULL);
}
Esempio n. 10
0
void
cut_teardown(void)
{
  grn_obj_close(context, database);
  grn_ctx_fin(context);
  g_free(context);
  teardown_grn_logger(logger);
  cut_remove_path(tmp_directory, NULL);
}
Esempio n. 11
0
void
cut_setup(void)
{
    cut_remove_path(tmp_directory, NULL);
    g_mkdir_with_parents(tmp_directory, 0700);
    path = g_build_filename(tmp_directory, "text-expr", NULL);
    context = g_new0(grn_ctx, 1);
    grn_ctx_init(context, 0);
    database = grn_db_create(context, path, NULL);

    expr = NULL;

    GRN_TEXT_INIT(&textbuf, 0);
    GRN_UINT32_INIT(&intbuf, 0);
}
Esempio n. 12
0
void
cut_teardown(void)
{
    grn_obj_close(context, &textbuf);
    grn_obj_close(context, &intbuf);

    if (expr)
        grn_obj_close(context, expr);

    grn_db_close(context, database);
    grn_ctx_fin(context);
    g_free(context);

    cut_remove_path(tmp_directory, NULL);
    g_free(path);
}
Esempio n. 13
0
void
setup (void)
{
    actual_address = NULL;
    actual_address_size = 0;

    expected_error = NULL;
    actual_error = NULL;

    tmp_dir = g_build_filename(milter_test_get_base_dir(),
                               "tmp",
                               NULL);
    cut_remove_path(tmp_dir, NULL);
    if (g_mkdir_with_parents(tmp_dir, 0700) == -1)
        cut_assert_errno();
}
Esempio n. 14
0
void
cut_setup(void)
{
  db = NULL;
  context = g_new0(grn_ctx, 1);

  base_dir = g_build_filename(grn_test_get_base_dir(), "tmp", NULL);
  default_path = g_build_filename(base_dir, "db", NULL);
  default_encoding = GRN_ENC_DEFAULT;
  default_context_flags = GRN_CTX_USE_QL;

  cut_remove_path(base_dir, NULL);
  g_mkdir_with_parents(base_dir, 0755);

  sample_ql_program = g_build_filename(grn_test_get_base_dir(),
                                       "..", "ql", "bookmark.scm", NULL);
}
Esempio n. 15
0
void
cut_setup(void)
{
  cut_remove_path(tmp_directory, NULL);
  g_mkdir_with_parents(tmp_directory, 0700);
  path = g_build_filename(tmp_directory, "text-table-select", NULL);
  grn_ctx_init(&context, 0);
  database = grn_db_create(&context, path, NULL);

  cond = NULL;
  expr = NULL;
  res = NULL;

  GRN_TEXT_INIT(&text_buf, 0);
  GRN_UINT32_INIT(&int_buf, 0);
  GRN_PTR_INIT(&ptr_buf, 0, GRN_ID_NIL);
}
Esempio n. 16
0
void
cut_setup(void)
{
  cut_remove_path(tmp_directory, NULL);
  g_mkdir_with_parents(tmp_directory, 0700);
  path = g_build_filename(tmp_directory, "text-expr", NULL);
  grn_ctx_init(&context, 0);
  database = grn_db_create(&context, path, NULL);

  expr = NULL;
  res = NULL;

  GRN_TEXT_INIT(&textbuf, 0);
  GRN_UINT32_INIT(&intbuf, 0);
  GRN_FLOAT_INIT(&floatbuf, 0);
  GRN_TIME_INIT(&timebuf, 0);
}
Esempio n. 17
0
void
teardown (void)
{
    if (actual_address)
        g_free(actual_address);

    if (expected_error)
        g_error_free(expected_error);
    if (actual_error)
        g_error_free(actual_error);

    if (tmp_dir) {
        g_chmod(tmp_dir, 0755);
        cut_remove_path(tmp_dir, NULL);
        g_free(tmp_dir);
    }
}
Esempio n. 18
0
void
cut_teardown(void)
{
  grn_obj_unlink(context, &buffer);
  if (column) {
    grn_obj_unlink(context, column);
  }
  if (table) {
    grn_obj_unlink(context, table);
  }

  grn_obj_close(context, database);
  grn_ctx_fin(context);
  g_free(context);

  teardown_grn_logger(logger);
  cut_remove_path(tmp_directory, NULL);
}
Esempio n. 19
0
void
cut_teardown(void)
{
  grn_obj_close(&context, &text_buf);
  grn_obj_close(&context, &int_buf);
  grn_obj_close(&context, &ptr_buf);

  if (res)
    grn_obj_close(&context, res);
  if (expr)
    grn_obj_close(&context, expr);
  if (cond)
    grn_obj_close(&context, cond);

  grn_obj_close(&context, database);
  grn_ctx_fin(&context);
  cut_remove_path(tmp_directory, NULL);
  g_free(path);
}
Esempio n. 20
0
void
cut_teardown(void)
{
  if (sub_processes)
    g_list_free(sub_processes);

  if (base_data)
    test_data_free(base_data);

  if (context) {
    if (table)
      grn_obj_close(context, table);
    if (space)
      grn_obj_close(context, space);
    grn_ctx_fin(context);
    g_free(context);
  }

#define RESTORE_ENV_VALUE(var_name, macro_name) do                      \
  {                                                                     \
    if (env_ ## var_name) {                                             \
      g_setenv(GRN_TEST_ENV_ ## macro_name, env_ ## var_name, TRUE);    \
      g_free(env_ ## var_name);                                         \
    } else {                                                            \
      g_unsetenv(GRN_TEST_ENV_ ## macro_name);                          \
    }                                                                   \
  } while(0)

  RESTORE_ENV_VALUE(table_path, TABLE_PATH);
  RESTORE_ENV_VALUE(table_type, TABLE_TYPE);
  RESTORE_ENV_VALUE(multi_thread, MULTI_THREAD);
  RESTORE_ENV_VALUE(n_processes, N_PROCESSES);
  RESTORE_ENV_VALUE(process_number, PROCESS_NUMBER);

#undef RESTORE_ENV_VALUE

  if (base_dir) {
    cut_remove_path(base_dir, NULL);
    g_free(base_dir);
  }
}
Esempio n. 21
0
void
setup (void)
{
  document = NULL;

  expected_font_names = NULL;
  actual_font_names = NULL;

  expected_action_types = NULL;
  actual_action_types = NULL;

  cut_set_fixture_data_dir (poppler_test_get_base_dir (),
                            "fixtures",
                            "pdf",
                            NULL);

  tmp_base_dir = g_build_filename (poppler_test_get_base_dir (), "tmp", NULL);
  cut_remove_path (tmp_base_dir, NULL);

  tmp_dir = g_build_filename (tmp_base_dir, "document", NULL);
  g_mkdir_with_parents (tmp_dir, 0755);
}
Esempio n. 22
0
void
cut_teardown(void)
{
  if (context) {
    if (db) {
      grn_obj_close(context, db);
    }
    grn_ctx_fin(context);
    g_free(context);
  }

  if (default_path) {
    g_free(default_path);
  }

  if (base_dir) {
    cut_remove_path(base_dir, NULL);
  }

  if (sample_ql_program) {
    g_free(sample_ql_program);
  }
}
void
cut_teardown (void)
{
    if (config)
        g_object_unref(config);
    if (loop)
        g_object_unref(loop);
    if (egg)
        g_object_unref(egg);
    if (another_egg)
        g_object_unref(another_egg);
    if (condition)
        g_object_unref(condition);

    if (expected_children)
        g_object_unref(expected_children);
    if (actual_children)
        g_object_unref(actual_children);

    if (expected_load_paths) {
        g_list_foreach(expected_load_paths, (GFunc)g_free, NULL);
        g_list_free(expected_load_paths);
    }

    if (expected_eggs)
        g_list_free(expected_eggs);
    if (expected_applicable_conditions)
        g_list_free(expected_applicable_conditions);

    if (actual_xml)
        g_free(actual_xml);

    if (tmp_dir) {
        cut_remove_path(tmp_dir, NULL);
        g_free(tmp_dir);
    }
}
Esempio n. 24
0
void
cut_teardown (void)
{
    if (idle_id > 0)
        milter_event_loop_remove(loop, idle_id);
    if (idle_shutdown_id > 0)
        milter_event_loop_remove(loop, idle_shutdown_id);

    if (server)
        g_object_unref(server);
    if (client)
        g_object_unref(client);

    if (decoder)
        g_object_unref(decoder);
    if (encoder)
        g_object_unref(encoder);

    if (option)
        g_object_unref(option);
    if (negotiate_option)
        g_object_unref(negotiate_option);

    if (macros_requests)
        g_object_unref(macros_requests);
    if (negotiate_macros_requests)
        g_object_unref(negotiate_macros_requests);

    if (connect_host_name)
        g_free(connect_host_name);
    if (connect_address)
        g_free(connect_address);

    if (helo_fqdn)
        g_free(helo_fqdn);

    if (envelope_from)
        g_free(envelope_from);

    if (envelope_recipient_to)
        g_free(envelope_recipient_to);

    if (header_name)
        g_free(header_name);
    if (header_value)
        g_free(header_value);

    if (body_chunk)
        g_free(body_chunk);

    if (unknown_command)
        g_free(unknown_command);

    if (actual_error)
        g_error_free(actual_error);
    if (expected_error)
        g_error_free(expected_error);

    if (tmp_dir) {
        cut_remove_path(tmp_dir, NULL);
        g_free(tmp_dir);
    }
}
static void
remove_tmp_directory(void)
{
  cut_remove_path(tmp_directory, NULL);
}
Esempio n. 26
0
void
cut_shutdown(void)
{
  g_free(tmp_directory);
  cut_remove_path(grn_test_get_tmp_dir(), NULL);
}