]> granicus.if.org Git - libexpat/commitdiff
Make test_nsalloc_realloc_long_ge_name() robust.
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 26 Jul 2017 17:13:06 +0000 (18:13 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Wed, 26 Jul 2017 17:56:37 +0000 (18:56 +0100)
Make test robust against memory allocation pattern changes

expat/tests/runtests.c

index cb96b2b2ecf0d973b7cb30b69b91c2ccb9f9b233..59dc1b24feb15801454fc84b30c0f13214e35bdd 100644 (file)
@@ -11605,15 +11605,9 @@ START_TEST(test_nsalloc_realloc_long_ge_name)
         { NULL, NULL }
     };
     int i;
-#define MAX_REALLOC_COUNT 5
-    int repeat = 0;
+#define MAX_REALLOC_COUNT 10
 
     for (i = 0; i < MAX_REALLOC_COUNT; i++) {
-        /* Repeat some counts to defeat caching */
-        if (i == 2 && repeat < 3) {
-            i--;
-            repeat++;
-        }
         reallocation_count = i;
         XML_SetUserData(parser, options);
         XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
@@ -11621,7 +11615,9 @@ START_TEST(test_nsalloc_realloc_long_ge_name)
         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");