]> granicus.if.org Git - libexpat/commitdiff
Tweak tests for greater allocation failure coverage
authorRhodri James <rhodri@kynesim.co.uk>
Tue, 14 Feb 2017 16:04:56 +0000 (16:04 +0000)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 16 Jul 2017 16:39:56 +0000 (18:39 +0200)
expat/tests/runtests.c

index 9bf84fda610fe1ede20c2a84f8932e941c27f4cb..530cef737b25a00265dfccb77a78d7dc6d1714b2 100644 (file)
@@ -3862,9 +3862,17 @@ START_TEST(test_alloc_ext_entity_set_encoding)
         "]>\n"
         "<doc>&en;</doc>";
     int i;
+    int repeat = 0;
 #define MAX_ALLOCATION_COUNT 20
 
     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;