コード例 #1
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);
}
コード例 #2
0
void
test_save_custom (void)
{
    GError *error = NULL;
    gchar *custom_config_path;

    custom_config_path = g_build_filename(tmp_dir,
                                          CUSTOM_CONFIG_FILE_NAME,
                                          NULL);
    cut_take_string(custom_config_path);

    milter_manager_configuration_prepend_load_path(config, tmp_dir);

    cut_assert_path_not_exist(custom_config_path);
    milter_manager_configuration_save_custom(config, "XXX", -1, &error);
    gcut_assert_error(error);
    cut_assert_path_exist(custom_config_path);
}