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

index 51930cb0d4e290be5874079736544842f1d06f67..d20d6d1c890bd12954dfb849842a6551c64c489f 100644 (file)
@@ -7943,25 +7943,17 @@ START_TEST(test_alloc_parse_pi)
         "Hello, world"
         "</doc>";
     int i;
-    int repeat = 0;
-#define MAX_ALLOC_COUNT 10
+#define MAX_ALLOC_COUNT 15
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
         allocation_count = i;
-        /* Repeat some counts because of cached memory */
-        if (i == 2 && repeat == 2) {
-            i -= 2;
-            repeat++;
-        } else if ((i == 1 && repeat < 2) ||
-                   (i == 1 && repeat > 2 && repeat < 5)) {
-            i--;
-            repeat++;
-        }
         XML_SetProcessingInstructionHandler(parser, dummy_pi_handler);
         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");