Make test_alloc_parse_xdecl_2() robust vs allocation pattern changes

This commit is contained in:
Rhodri James 2017-07-26 18:41:22 +01:00
parent 52970d4a53
commit ebe390bab0

View File

@ -7912,27 +7912,18 @@ START_TEST(test_alloc_parse_xdecl_2)
"'?>"
"<doc>Hello, world</doc>";
int i;
int repeat = 0;
#define MAX_ALLOC_COUNT 10
#define MAX_ALLOC_COUNT 20
for (i = 0; i < MAX_ALLOC_COUNT; i++) {
/* Repeat counts to defeat cached allocations */
if (i == 4 && repeat == 3) {
i -= 2;
repeat++;
}
else if ((i == 2 && repeat < 3) ||
(i == 3 && repeat > 3)) {
i--;
repeat++;
}
allocation_count = i;
XML_SetXmlDeclHandler(parser, dummy_xdecl_handler);
XML_SetUnknownEncodingHandler(parser, long_encoding_handler, NULL);
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("Parse succeeded despite failing allocator");