From f558d28695d824e33d67c19848925949c2c1fc36 Mon Sep 17 00:00:00 2001 From: bluhm Date: Mon, 1 Apr 2024 13:46:06 +0000 Subject: [PATCH] Add some #ifdef XML_TESTING to the libexpat tests. Upstream builds special libexpat objects for testing with an internal flag and counter. As OpenBSD does test the installed production library, disable tests that depend on special options. Use the same define that activates the test code in the library. Without this, regress would not compile. --- lib/libexpat/tests/basic_tests.c | 8 ++++++++ lib/libexpat/tests/runtests.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lib/libexpat/tests/basic_tests.c b/lib/libexpat/tests/basic_tests.c index 91c8dd7a392..372089a9dbb 100644 --- a/lib/libexpat/tests/basic_tests.c +++ b/lib/libexpat/tests/basic_tests.c @@ -5244,6 +5244,7 @@ START_TEST(test_nested_entity_suspend) { } END_TEST +#if defined(XML_TESTING) /* Regression test for quadratic parsing on large tokens */ START_TEST(test_big_tokens_scale_linearly) { const struct { @@ -5329,6 +5330,7 @@ START_TEST(test_big_tokens_scale_linearly) { } } END_TEST +#endif START_TEST(test_set_reparse_deferral) { const char *const pre = ""; @@ -5727,6 +5729,7 @@ START_TEST(test_bypass_heuristic_when_close_to_bufsize) { } END_TEST +#if defined(XML_TESTING) START_TEST(test_varying_buffer_fills) { const int KiB = 1024; const int MiB = 1024 * KiB; @@ -5839,6 +5842,7 @@ START_TEST(test_varying_buffer_fills) { free(document); } END_TEST +#endif void make_basic_test_case(Suite *s) { @@ -6082,12 +6086,16 @@ make_basic_test_case(Suite *s) { tcase_add_test__ifdef_xml_dtd(tc_basic, test_pool_integrity_with_unfinished_attr); tcase_add_test__if_xml_ge(tc_basic, test_nested_entity_suspend); +#if defined(XML_TESTING) tcase_add_test(tc_basic, test_big_tokens_scale_linearly); +#endif tcase_add_test(tc_basic, test_set_reparse_deferral); tcase_add_test(tc_basic, test_reparse_deferral_is_inherited); tcase_add_test(tc_basic, test_set_reparse_deferral_on_null_parser); tcase_add_test(tc_basic, test_set_reparse_deferral_on_the_fly); tcase_add_test(tc_basic, test_set_bad_reparse_option); tcase_add_test(tc_basic, test_bypass_heuristic_when_close_to_bufsize); +#if defined(XML_TESTING) tcase_add_test(tc_basic, test_varying_buffer_fills); +#endif } diff --git a/lib/libexpat/tests/runtests.c b/lib/libexpat/tests/runtests.c index ecb1c36be58..3e0169ef740 100644 --- a/lib/libexpat/tests/runtests.c +++ b/lib/libexpat/tests/runtests.c @@ -101,7 +101,9 @@ main(int argc, char *argv[]) { for (g_chunkSize = 0; g_chunkSize <= 5; g_chunkSize++) { for (int enabled = 0; enabled <= 1; ++enabled) { char context[100]; +#if defined(XML_TESTING) g_reparseDeferralEnabledDefault = enabled; +#endif snprintf(context, sizeof(context), "chunksize=%d deferral=%d", g_chunkSize, enabled); context[sizeof(context) - 1] = '\0'; -- 2.20.1