summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-04-01 13:46:07 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-04-01 13:46:07 +0000
commit96bdeb7b105270763efdaf9c7aba2c0ce77fb236 (patch)
treeab27c4f84a879a86011e52dc9526a99ac35107a0 /lib
parent344489002cf603160ba79ac4d761237a597cff9a (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/libexpat/tests/basic_tests.c8
-rw-r--r--lib/libexpat/tests/runtests.c2
2 files changed, 10 insertions, 0 deletions
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 = "<d>";
@@ -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';