]> granicus.if.org Git - libexpat/commitdiff
Make test_nsalloc_less_long_namespace() robust vs allocation changes
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 26 Jul 2017 17:08:40 +0000 (18:08 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Wed, 26 Jul 2017 17:08:40 +0000 (18:08 +0100)
expat/tests/runtests.c

index b90174fb6f60e99f28e3d91b93ef12bb3e370107..fa4e97446e8b4913247421898f2ff75d6d5d87f5 100644 (file)
@@ -11222,33 +11222,16 @@ START_TEST(test_nsalloc_less_long_namespace)
         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678"
         ":e>";
     int i;
-#define MAX_ALLOC_COUNT 10
-    int repeat = 0;
+#define MAX_ALLOC_COUNT 40
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat some counts to defeat cached allocations */
-        if ((i == 4 && (repeat == 3 || repeat == 5)) ||
-            (i == 7 && repeat == 10)) {
-            i -= 2;
-            repeat++;
-        }
-        else if ((i == 2 && repeat < 2) ||
-                 (i == 3 && (repeat == 2 ||
-                             repeat == 4 ||
-                             repeat == 6)) ||
-                 (i == 4 && repeat == 7) ||
-                 (i == 5 && (repeat == 8 ||
-                             repeat == 9)) ||
-                 (i == 6 && (repeat == 11 || repeat == 12)) ||
-                 (i == 7 && repeat == 13)) {
-            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_nsalloc_xmlns() */
+        nsalloc_teardown();
+        nsalloc_setup();
     }
     if (i == 0)
         fail("Parsing worked despite failing allocations");