summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhodri James <rhodri@kynesim.co.uk>2017-07-27 14:28:31 +0100
committerRhodri James <rhodri@kynesim.co.uk>2017-07-27 14:28:31 +0100
commit075aa7c179d3b54d424ff93484c42851b47d2d7d (patch)
tree5fb4676492588727287f91606b0953a2de0eef9e
parenta7ae0fc8049a147050db93d425232700b4d445a0 (diff)
downloadlibexpat-git-075aa7c179d3b54d424ff93484c42851b47d2d7d.tar.gz
Make test_alloc_long_base() robust vs allocation pattern changes
-rw-r--r--expat/tests/runtests.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c
index da08a39f..28cbc756 100644
--- a/expat/tests/runtests.c
+++ b/expat/tests/runtests.c
@@ -9993,21 +9993,9 @@ START_TEST(test_alloc_long_base)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789A/"
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789A/";
int i;
- #define MAX_ALLOC_COUNT 20
- int repeat = 0;
+ #define MAX_ALLOC_COUNT 25
for (i = 0; i < MAX_ALLOC_COUNT; i++) {
- /* Repeat some counts to defeat cached allocations */
- if (i == 4 && repeat == 4) {
- i -= 2;
- repeat++;
- }
- else if ((i == 2 && repeat < 4) ||
- (i == 3 && repeat == 5) ||
- (i == 4 && repeat == 6)) {
- i--;
- repeat++;
- }
allocation_count = i;
XML_SetUserData(parser, entity_text);
XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
@@ -10019,7 +10007,9 @@ START_TEST(test_alloc_long_base)
if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text),
XML_TRUE) != XML_STATUS_ERROR)
break;
- XML_ParserReset(parser, NULL);
+ /* See comment in test_alloc_parse_xdecl() */
+ alloc_teardown();
+ alloc_setup();
}
if (i == 0)
fail("Parsing worked despite failing allocations");