]> granicus.if.org Git - libexpat/commitdiff
Make test_alloc_large_group() robust vs allocation pattern changes
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 13:02:03 +0000 (14:02 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 13:02:03 +0000 (14:02 +0100)
expat/tests/runtests.c

index 8a78c0bb056f74edda95f77dc4aa8ee07fa9f13e..82d39cc0b564b38cfdbf6c6b970d6f58beeb65d2 100644 (file)
@@ -9438,24 +9438,18 @@ START_TEST(test_alloc_large_group)
         "<a1/>\n"
         "</doc>\n";
     int i;
-#define MAX_ALLOC_COUNT 45
-    int repeat = 0;
+#define MAX_ALLOC_COUNT 50
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat some counts to defeat cached allocations */
-        if ((i == 2 && repeat < 3) ||
-            (i == 3 && repeat == 3) ||
-            (i == 37 && repeat == 4)) {
-            i--;
-            repeat++;
-        }
         allocation_count = i;
         XML_SetElementDeclHandler(parser, dummy_element_decl_handler);
         dummy_handler_flags = 0;
         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");