]> granicus.if.org Git - libexpat/commitdiff
Make test_nsalloc_prefixed_element() robust vs allocation changes
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 26 Jul 2017 17:20:58 +0000 (18:20 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Wed, 26 Jul 2017 17:56:37 +0000 (18:56 +0100)
expat/tests/runtests.c

index f9ca3396f851bfd35b22ec6745d1e20256c3f9a6..59a426fa7e898ce325905fcf5f75d110e9f08b66 100644 (file)
@@ -11880,25 +11880,9 @@ START_TEST(test_nsalloc_prefixed_element)
         { NULL, NULL }
     };
     int i;
-#define MAX_ALLOC_COUNT 40
-    int repeat = 0;
+#define MAX_ALLOC_COUNT 70
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat some counts to defeat cached allocations */
-        if ((i == 4 && repeat == 3) ||
-            (i == 14 && repeat == 9) ||
-            (i == 15 && repeat == 10)) {
-            i -= 2;
-            repeat++;
-        }
-        else if ((i == 2 && repeat < 2) ||
-                 (i == 3 && (repeat == 2 || repeat == 4 || repeat == 5)) ||
-                 (i == 4 && repeat == 6) ||
-                 (i == 6 && repeat == 7) ||
-                 (i == 8 && repeat == 8)) {
-            i--;
-            repeat++;
-        }
         allocation_count = i;
         XML_SetUserData(parser, options);
         XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
@@ -11907,8 +11891,9 @@ START_TEST(test_nsalloc_prefixed_element)
                                     XML_TRUE) != XML_STATUS_ERROR)
             break;
 
-        XML_ParserFree(parser);
-        parser = XML_ParserCreate(NULL);
+        /* See comment in test_nsalloc_xmlns() */
+        nsalloc_teardown();
+        nsalloc_setup();
     }
     if (i == 0)
         fail("Success despite failing allocator");