From ae873210206815594566c705f27bf00124fcf984 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 29 Sep 2019 21:11:33 +0200 Subject: [PATCH] runtests.c: Fix for -DEXPAT_DTD=OFF --- tests/runtests.c | 140 +++++++++++++++++++++++++++---------------------- 1 file changed, 77 insertions(+), 63 deletions(-) diff --git a/tests/runtests.c b/tests/runtests.c index 2c951f5..7791fe0 100644 --- a/tests/runtests.c +++ b/tests/runtests.c @@ -108,6 +108,16 @@ typedef unsigned __int64 uint64_t; static XML_Parser g_parser = NULL; +void +tcase_add_test__ifdef_xml_dtd(TCase *tc, tcase_test_function test) { +#ifdef XML_DTD + tcase_add_test(tc, test); +#else + UNUSED_P(tc); + UNUSED_P(test); +#endif +} + static void basic_setup(void) { g_parser = XML_ParserCreate(NULL); @@ -7506,7 +7516,6 @@ START_TEST(test_misc_stop_during_end_handler_issue_240_2) { } END_TEST -#ifdef XML_DTD START_TEST(test_misc_deny_internal_entity_closing_doctype_issue_317) { const char *const inputOne = "'>\n" @@ -7567,7 +7576,6 @@ START_TEST(test_misc_deny_internal_entity_closing_doctype_issue_317) { } } END_TEST -#endif static void alloc_setup(void) { @@ -11285,13 +11293,14 @@ make_suite(void) { test_wfc_undeclared_entity_with_external_subset_standalone); tcase_add_test(tc_basic, test_entity_with_external_subset_unless_standalone); tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs); - tcase_add_test(tc_basic, test_ext_entity_set_encoding); - tcase_add_test(tc_basic, test_ext_entity_no_handler); - tcase_add_test(tc_basic, test_ext_entity_set_bom); - tcase_add_test(tc_basic, test_ext_entity_bad_encoding); - tcase_add_test(tc_basic, test_ext_entity_bad_encoding_2); - tcase_add_test(tc_basic, test_ext_entity_invalid_parse); - tcase_add_test(tc_basic, test_ext_entity_invalid_suspended_parse); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_set_encoding); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_no_handler); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_set_bom); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_bad_encoding); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_bad_encoding_2); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_invalid_parse); + tcase_add_test__ifdef_xml_dtd(tc_basic, + test_ext_entity_invalid_suspended_parse); tcase_add_test(tc_basic, test_dtd_default_handling); tcase_add_test(tc_basic, test_dtd_attr_handling); tcase_add_test(tc_basic, test_empty_ns_without_namespaces); @@ -11316,12 +11325,13 @@ make_suite(void) { tcase_add_test(tc_basic, test_memory_allocation); tcase_add_test(tc_basic, test_default_current); tcase_add_test(tc_basic, test_dtd_elements); - tcase_add_test(tc_basic, test_set_foreign_dtd); - tcase_add_test(tc_basic, test_foreign_dtd_not_standalone); - tcase_add_test(tc_basic, test_invalid_foreign_dtd); - tcase_add_test(tc_basic, test_foreign_dtd_with_doctype); - tcase_add_test(tc_basic, test_foreign_dtd_without_external_subset); - tcase_add_test(tc_basic, test_empty_foreign_dtd); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_set_foreign_dtd); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_foreign_dtd_not_standalone); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_invalid_foreign_dtd); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_foreign_dtd_with_doctype); + tcase_add_test__ifdef_xml_dtd(tc_basic, + test_foreign_dtd_without_external_subset); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_empty_foreign_dtd); tcase_add_test(tc_basic, test_set_base); tcase_add_test(tc_basic, test_attributes); tcase_add_test(tc_basic, test_reset_in_entity); @@ -11338,8 +11348,8 @@ make_suite(void) { tcase_add_test(tc_basic, test_trailing_rsqb); tcase_add_test(tc_basic, test_ext_entity_trailing_rsqb); tcase_add_test(tc_basic, test_ext_entity_good_cdata); - tcase_add_test(tc_basic, test_user_parameters); - tcase_add_test(tc_basic, test_ext_entity_ref_parameter); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_user_parameters); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_ref_parameter); tcase_add_test(tc_basic, test_empty_parse); tcase_add_test(tc_basic, test_get_buffer_1); tcase_add_test(tc_basic, test_get_buffer_2); @@ -11347,25 +11357,26 @@ make_suite(void) { tcase_add_test(tc_basic, test_byte_info_at_error); tcase_add_test(tc_basic, test_byte_info_at_cdata); tcase_add_test(tc_basic, test_predefined_entities); - tcase_add_test(tc_basic, test_invalid_tag_in_dtd); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_invalid_tag_in_dtd); tcase_add_test(tc_basic, test_not_predefined_entities); - tcase_add_test(tc_basic, test_ignore_section); - tcase_add_test(tc_basic, test_ignore_section_utf16); - tcase_add_test(tc_basic, test_ignore_section_utf16_be); - tcase_add_test(tc_basic, test_bad_ignore_section); - tcase_add_test(tc_basic, test_external_entity_values); - tcase_add_test(tc_basic, test_ext_entity_not_standalone); - tcase_add_test(tc_basic, test_ext_entity_value_abort); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ignore_section); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ignore_section_utf16); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ignore_section_utf16_be); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_bad_ignore_section); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_external_entity_values); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_not_standalone); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_ext_entity_value_abort); tcase_add_test(tc_basic, test_bad_public_doctype); tcase_add_test(tc_basic, test_attribute_enum_value); tcase_add_test(tc_basic, test_predefined_entity_redefinition); - tcase_add_test(tc_basic, test_dtd_stop_processing); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_dtd_stop_processing); tcase_add_test(tc_basic, test_public_notation_no_sysid); tcase_add_test(tc_basic, test_nested_groups); tcase_add_test(tc_basic, test_group_choice); tcase_add_test(tc_basic, test_standalone_parameter_entity); - tcase_add_test(tc_basic, test_skipped_parameter_entity); - tcase_add_test(tc_basic, test_recursive_external_parameter_entity); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_skipped_parameter_entity); + tcase_add_test__ifdef_xml_dtd(tc_basic, + test_recursive_external_parameter_entity); tcase_add_test(tc_basic, test_undefined_ext_entity_in_external_dtd); tcase_add_test(tc_basic, test_suspend_xdecl); tcase_add_test(tc_basic, test_abort_epilog); @@ -11375,9 +11386,9 @@ make_suite(void) { tcase_add_test(tc_basic, test_unfinished_epilog); tcase_add_test(tc_basic, test_partial_char_in_epilog); tcase_add_test(tc_basic, test_hash_collision); - tcase_add_test(tc_basic, test_suspend_resume_internal_entity); - tcase_add_test(tc_basic, test_resume_entity_with_syntax_error); - tcase_add_test(tc_basic, test_suspend_resume_parameter_entity); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_suspend_resume_internal_entity); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_resume_entity_with_syntax_error); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_suspend_resume_parameter_entity); tcase_add_test(tc_basic, test_restart_on_error); tcase_add_test(tc_basic, test_reject_lt_in_attribute_value); tcase_add_test(tc_basic, test_reject_unfinished_param_in_att_value); @@ -11386,7 +11397,7 @@ make_suite(void) { tcase_add_test(tc_basic, test_skipped_external_entity); tcase_add_test(tc_basic, test_skipped_null_loaded_ext_entity); tcase_add_test(tc_basic, test_skipped_unloaded_ext_entity); - tcase_add_test(tc_basic, test_param_entity_with_trailing_cr); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_param_entity_with_trailing_cr); tcase_add_test(tc_basic, test_invalid_character_entity); tcase_add_test(tc_basic, test_invalid_character_entity_2); tcase_add_test(tc_basic, test_invalid_character_entity_3); @@ -11429,7 +11440,7 @@ make_suite(void) { tcase_add_test(tc_basic, test_utf16_attribute); tcase_add_test(tc_basic, test_utf16_second_attr); tcase_add_test(tc_basic, test_attr_after_solidus); - tcase_add_test(tc_basic, test_utf16_pe); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_utf16_pe); tcase_add_test(tc_basic, test_bad_attr_desc_keyword); tcase_add_test(tc_basic, test_bad_attr_desc_keyword_utf16); tcase_add_test(tc_basic, test_bad_doctype); @@ -11437,11 +11448,11 @@ make_suite(void) { tcase_add_test(tc_basic, test_bad_doctype_plus); tcase_add_test(tc_basic, test_bad_doctype_star); tcase_add_test(tc_basic, test_bad_doctype_query); - tcase_add_test(tc_basic, test_unknown_encoding_bad_ignore); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_unknown_encoding_bad_ignore); tcase_add_test(tc_basic, test_entity_in_utf16_be_attr); tcase_add_test(tc_basic, test_entity_in_utf16_le_attr); - tcase_add_test(tc_basic, test_entity_public_utf16_be); - tcase_add_test(tc_basic, test_entity_public_utf16_le); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_entity_public_utf16_be); + tcase_add_test__ifdef_xml_dtd(tc_basic, test_entity_public_utf16_le); tcase_add_test(tc_basic, test_short_doctype); tcase_add_test(tc_basic, test_short_doctype_2); tcase_add_test(tc_basic, test_short_doctype_3); @@ -11460,7 +11471,8 @@ make_suite(void) { tcase_add_test(tc_namespace, test_ns_tagname_overwrite); tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet); tcase_add_test(tc_namespace, test_start_ns_clears_start_element); - tcase_add_test(tc_namespace, test_default_ns_from_ext_subset_and_ext_ge); + tcase_add_test__ifdef_xml_dtd(tc_namespace, + test_default_ns_from_ext_subset_and_ext_ge); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_1); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3); @@ -11501,10 +11513,8 @@ make_suite(void) { tcase_add_test(tc_misc, test_misc_utf16le); tcase_add_test(tc_misc, test_misc_stop_during_end_handler_issue_240_1); tcase_add_test(tc_misc, test_misc_stop_during_end_handler_issue_240_2); -#ifdef XML_DTD - tcase_add_test(tc_misc, - test_misc_deny_internal_entity_closing_doctype_issue_317); -#endif + tcase_add_test__ifdef_xml_dtd( + tc_misc, test_misc_deny_internal_entity_closing_doctype_issue_317); suite_add_tcase(s, tc_alloc); tcase_add_checked_fixture(tc_alloc, alloc_setup, alloc_teardown); @@ -11515,45 +11525,49 @@ make_suite(void) { tcase_add_test(tc_alloc, test_alloc_parse_pi_3); tcase_add_test(tc_alloc, test_alloc_parse_comment); tcase_add_test(tc_alloc, test_alloc_parse_comment_2); - tcase_add_test(tc_alloc, test_alloc_create_external_parser); - tcase_add_test(tc_alloc, test_alloc_run_external_parser); - tcase_add_test(tc_alloc, test_alloc_dtd_copy_default_atts); - tcase_add_test(tc_alloc, test_alloc_external_entity); - tcase_add_test(tc_alloc, test_alloc_ext_entity_set_encoding); - tcase_add_test(tc_alloc, test_alloc_internal_entity); - tcase_add_test(tc_alloc, test_alloc_dtd_default_handling); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_create_external_parser); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_run_external_parser); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_dtd_copy_default_atts); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_external_entity); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_ext_entity_set_encoding); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_internal_entity); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_dtd_default_handling); tcase_add_test(tc_alloc, test_alloc_explicit_encoding); tcase_add_test(tc_alloc, test_alloc_set_base); tcase_add_test(tc_alloc, test_alloc_realloc_buffer); tcase_add_test(tc_alloc, test_alloc_ext_entity_realloc_buffer); tcase_add_test(tc_alloc, test_alloc_realloc_many_attributes); - tcase_add_test(tc_alloc, test_alloc_public_entity_value); - tcase_add_test(tc_alloc, test_alloc_realloc_subst_public_entity_value); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_public_entity_value); + tcase_add_test__ifdef_xml_dtd(tc_alloc, + test_alloc_realloc_subst_public_entity_value); tcase_add_test(tc_alloc, test_alloc_parse_public_doctype); tcase_add_test(tc_alloc, test_alloc_parse_public_doctype_long_name); - tcase_add_test(tc_alloc, test_alloc_set_foreign_dtd); - tcase_add_test(tc_alloc, test_alloc_attribute_enum_value); - tcase_add_test(tc_alloc, test_alloc_realloc_attribute_enum_value); - tcase_add_test(tc_alloc, test_alloc_realloc_implied_attribute); - tcase_add_test(tc_alloc, test_alloc_realloc_default_attribute); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_set_foreign_dtd); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_attribute_enum_value); + tcase_add_test__ifdef_xml_dtd(tc_alloc, + test_alloc_realloc_attribute_enum_value); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_realloc_implied_attribute); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_realloc_default_attribute); tcase_add_test(tc_alloc, test_alloc_notation); tcase_add_test(tc_alloc, test_alloc_public_notation); tcase_add_test(tc_alloc, test_alloc_system_notation); - tcase_add_test(tc_alloc, test_alloc_nested_groups); - tcase_add_test(tc_alloc, test_alloc_realloc_nested_groups); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_nested_groups); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_realloc_nested_groups); tcase_add_test(tc_alloc, test_alloc_large_group); - tcase_add_test(tc_alloc, test_alloc_realloc_group_choice); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_realloc_group_choice); tcase_add_test(tc_alloc, test_alloc_pi_in_epilog); tcase_add_test(tc_alloc, test_alloc_comment_in_epilog); - tcase_add_test(tc_alloc, test_alloc_realloc_long_attribute_value); + tcase_add_test__ifdef_xml_dtd(tc_alloc, + test_alloc_realloc_long_attribute_value); tcase_add_test(tc_alloc, test_alloc_attribute_whitespace); tcase_add_test(tc_alloc, test_alloc_attribute_predefined_entity); tcase_add_test(tc_alloc, test_alloc_long_attr_default_with_char_ref); tcase_add_test(tc_alloc, test_alloc_long_attr_value); - tcase_add_test(tc_alloc, test_alloc_nested_entities); - tcase_add_test(tc_alloc, test_alloc_realloc_param_entity_newline); - tcase_add_test(tc_alloc, test_alloc_realloc_ce_extends_pe); - tcase_add_test(tc_alloc, test_alloc_realloc_attributes); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_nested_entities); + tcase_add_test__ifdef_xml_dtd(tc_alloc, + test_alloc_realloc_param_entity_newline); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_realloc_ce_extends_pe); + tcase_add_test__ifdef_xml_dtd(tc_alloc, test_alloc_realloc_attributes); tcase_add_test(tc_alloc, test_alloc_long_doc_name); tcase_add_test(tc_alloc, test_alloc_long_base); tcase_add_test(tc_alloc, test_alloc_long_public_id); -- 1.8.3.1