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

index 4de92514a2b06d3a6f9f880f75e43c0fd74a4d22..da08a39f29feb8d327e5d5e1838de631e93b6404 100644 (file)
@@ -9947,21 +9947,16 @@ START_TEST(test_alloc_long_doc_name)
         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
         " a='1'/>";
     int i;
-#define MAX_ALLOC_COUNT 10
-    int repeat = 0;
+#define MAX_ALLOC_COUNT 20
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat certain counts to defeat cached allocations */
-        if ((i == 2 && repeat < 4) ||
-            (i == 3 && repeat < 6)) {
-            i--;
-            repeat++;
-        }
         allocation_count = i;
         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 reallocations");