Make test_alloc_public_entity_value() robust vs allocation changes

This commit is contained in:
Rhodri James 2017-07-27 13:29:26 +01:00
parent 8ab97e4a96
commit b2eac2615f

View File

@ -8725,20 +8725,9 @@ START_TEST(test_alloc_public_entity_value)
" '%e1;'>\n"
"%e1;\n";
int i;
#define MAX_ALLOC_COUNT 25
int repeat = 0;
#define MAX_ALLOC_COUNT 50
for (i = 0; i < MAX_ALLOC_COUNT; i++) {
/* Repeat certain counts to defeat cached allocations */
if ((i == 2 && repeat < 2) ||
(i == 3 && repeat == 2) ||
(i == 8 && repeat == 3) ||
(i == 9 && repeat == 4) ||
(i == 18 && repeat == 5) ||
(i == 19 && repeat == 6)) {
i--;
repeat++;
}
allocation_count = i;
dummy_handler_flags = 0;
XML_SetUserData(parser, dtd_text);
@ -8749,7 +8738,9 @@ START_TEST(test_alloc_public_entity_value)
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 allocation");