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

index e6b492eef25418665cd11f4ba28d82f3fd238359..468f0c11c06af0626d01de49e0d8a71ebba40dee 100644 (file)
@@ -8377,17 +8377,9 @@ START_TEST(test_alloc_ext_entity_set_encoding)
         "]>\n"
         "<doc>&en;</doc>";
     int i;
-    int repeat = 0;
-#define MAX_ALLOCATION_COUNT 20
+#define MAX_ALLOCATION_COUNT 30
 
     for (i = 0; i < MAX_ALLOCATION_COUNT; i++) {
-        /* Repeat some counts to get round caching */
-        if ((i == 2 && repeat < 3) ||
-            (i == 3 && repeat < 6) ||
-            (i == 4 && repeat == 6)) {
-            i--;
-            repeat++;
-        }
         XML_SetExternalEntityRefHandler(parser,
                                         external_entity_alloc_set_encoding);
         allocation_count = i;
@@ -8395,7 +8387,9 @@ START_TEST(test_alloc_ext_entity_set_encoding)
                                     XML_TRUE) == XML_STATUS_OK)
             break;
         allocation_count = -1;
-        XML_ParserReset(parser, NULL);
+        /* See comment in test_alloc_parse_xdecl() */
+        alloc_teardown();
+        alloc_setup();
     }
     if (i == 0)
         fail("Encoding check succeeded despite failing allocator");