Make test_nsalloc_realloc_long_context_in_dtd() robust.

Makes test more predictable in the face of changes in the pattern
of memory allocations inside the library.
This commit is contained in:
Rhodri James 2017-07-26 18:14:46 +01:00
parent a058960647
commit ebbc2c1517

View File

@ -11713,15 +11713,9 @@ START_TEST(test_nsalloc_realloc_long_context_in_dtd)
{ NULL, NULL }
};
int i;
#define MAX_REALLOC_COUNT 10
int repeat = 0;
#define MAX_REALLOC_COUNT 20
for (i = 0; i < MAX_REALLOC_COUNT; i++) {
/* Repeat some counts to defeat allocation caching */
if (i == 2 && repeat < 11) {
i--;
repeat++;
}
reallocation_count = i;
XML_SetUserData(parser, options);
XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
@ -11729,7 +11723,9 @@ START_TEST(test_nsalloc_realloc_long_context_in_dtd)
if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text),
XML_TRUE) != XML_STATUS_ERROR)
break;
XML_ParserReset(parser, NULL);
/* See comment in test_nsalloc_xmlns() */
nsalloc_teardown();
nsalloc_setup();
}
if (i == 0)
fail("Parsing worked despite failing reallocations");