Test not-so-long namespace with failing allocator
This commit is contained in:
parent
ddd6a15043
commit
90f5d5e833
@ -8947,6 +8947,98 @@ START_TEST(test_nsalloc_long_namespace)
|
||||
#undef MAX_ALLOC_COUNT
|
||||
END_TEST
|
||||
|
||||
/* Using a slightly shorter namespace name provokes allocations in
|
||||
* slightly different places in the code.
|
||||
*/
|
||||
START_TEST(test_nsalloc_less_long_namespace)
|
||||
{
|
||||
const char *text =
|
||||
"<"
|
||||
/* 64 characters per line */
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678"
|
||||
":e xmlns:"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678"
|
||||
"='http://example.org/'>\n"
|
||||
"<"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678"
|
||||
":f "
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678"
|
||||
":att='foo'/>\n"
|
||||
"</"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678"
|
||||
":e>";
|
||||
int i;
|
||||
#define MAX_ALLOC_COUNT 10
|
||||
int repeat = 0;
|
||||
|
||||
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);
|
||||
}
|
||||
if (i == 0)
|
||||
fail("Parsing worked despite failing allocations");
|
||||
else if (i == MAX_ALLOC_COUNT)
|
||||
fail("Parsing failed even at max allocation count");
|
||||
}
|
||||
#undef MAX_ALLOC_COUNT
|
||||
END_TEST
|
||||
|
||||
|
||||
static Suite *
|
||||
make_suite(void)
|
||||
@ -9200,6 +9292,7 @@ make_suite(void)
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_realloc_long_prefix);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_realloc_longer_prefix);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_long_namespace);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_less_long_namespace);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user