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

index c790af0160c2c3362e35f2654c94a4164ed28a4a..71114f30b386c7533b2471a02e11e11dffc090d6 100644 (file)
@@ -10765,29 +10765,9 @@ START_TEST(test_nsalloc_long_attr_prefix)
         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
     };
     int i;
-#define MAX_ALLOC_COUNT 15
-    int repeated = 0;
+#define MAX_ALLOC_COUNT 40
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat some counts to flush out cached allocations */
-        if ((i == 4 && (repeated == 3 || repeated == 6)) ||
-            (i == 7 && repeated == 9) ||
-            (i == 10 && repeated == 12)) {
-            i -= 2;
-            repeated++;
-        }
-        else if ((i == 2 && repeated < 2) ||
-                 (i == 3 &&
-                  (repeated == 2 ||
-                   repeated == 4 ||
-                   repeated == 5 ||
-                   repeated == 7)) ||
-                 (i == 5 && repeated == 8) ||
-                 (i == 6 && repeated == 10) ||
-                 (i == 8 && repeated == 11)) {
-            i--;
-            repeated++;
-        }
         allocation_count = i;
         XML_SetReturnNSTriplet(parser, XML_TRUE);
         XML_SetUserData(parser, elemstr);
@@ -10797,7 +10777,9 @@ START_TEST(test_nsalloc_long_attr_prefix)
         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");