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

index 871d01e645891c4be29c9d0913e047f1df1eb65d..5bc10b05aafd666868adf66b32f5a0e42c05a9e5 100644 (file)
@@ -8042,25 +8042,17 @@ START_TEST(test_alloc_parse_comment)
         "<!-- Test parsing this comment -->"
         "<doc>Hi</doc>";
     int i;
-    int repeat = 0;
-#define MAX_ALLOC_COUNT 10
+#define MAX_ALLOC_COUNT 15
 
     for (i = 0; i < MAX_ALLOC_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++;
-        }
         allocation_count = i;
         XML_SetCommentHandler(parser, dummy_comment_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");