/* test that loading a config without a line configuration for process lines produces FH_ERROR */ void test_failure_when_loading_config_with_no_line_configuration_for_process_lines() { const char *filename; fh_shr_cfg_lh_proc_t lh_config; fh_cfg_node_t *config; FILE *outfile; filename = empty_config(); outfile = fopen(filename, "a"); fprintf(outfile, "itch = {\n"); fprintf(outfile, " processes = {\n"); fprintf(outfile, " foo = {\n"); fprintf(outfile, " lines = ( \"foo\" )\n"); fprintf(outfile, " }\n"); fprintf(outfile, " }\n"); fprintf(outfile, " lines = {\n"); fprintf(outfile, " bar = {\n"); fprintf(outfile, " primary = { address:\"10.0.0.1\" port:12345 interface:eth0 }\n"); fprintf(outfile, " }\n"); fprintf(outfile, " }\n"); fprintf(outfile, "}\n"); fclose(outfile); config = fh_cfg_load(filename); delete_config(filename); memset(&lh_config, 0, sizeof(fh_shr_cfg_lh_proc_t)); FH_TEST_ASSERT_NOTNULL(config); FH_TEST_ASSERT_EQUAL(fh_shr_cfg_lh_load("foo", "itch", config, &lh_config), FH_ERROR); }
/* default process */ void test_get_proc_failure_with_no_name_and_invalid_config() { const char *filename; fh_cfg_node_t *config; char process[MAX_PROPERTY_LENGTH] = "\0"; filename = empty_config(); config = fh_cfg_load(filename); delete_config(filename); FH_TEST_ASSERT_NOTNULL(config); FH_TEST_ASSERT_EQUAL(fh_shr_cfg_lh_get_proc(process, "itch", config), FH_ERROR); }
/** * create the test suite for sanei config related tests */ static void sanei_config_suite (void) { /* tests */ inexistent_config (); empty_config (); null_config (); null_attach (); string_option (); int_option (); string_list_option (); word_array_option (); bool_option (); fixed_option (); wrong_range_int_option (); wrong_string_list_option (); wrong_bool_option (); wrong_fixed_option (); /* backend real conf inspired cases */ umax_pp (); snapscan (); }
/* test that loading a config without and lines produces FH_ERROR */ void test_failure_when_loading_config_with_no_lines() { const char *filename; fh_shr_cfg_lh_proc_t lh_config; fh_cfg_node_t *config; FILE *outfile; filename = empty_config(); outfile = fopen(filename, "a"); fprintf(outfile, "itch = {\n"); fprintf(outfile, " processes = {\n"); fprintf(outfile, " foo = {\n"); fprintf(outfile, " }\n"); fprintf(outfile, " }\n"); fprintf(outfile, "}\n"); fclose(outfile); config = fh_cfg_load(filename); delete_config(filename); memset(&lh_config, 0, sizeof(fh_shr_cfg_lh_proc_t)); FH_TEST_ASSERT_NOTNULL(config); FH_TEST_ASSERT_EQUAL(fh_shr_cfg_lh_load("foo", "itch", config, &lh_config), FH_ERROR); }