diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-05-13 16:45:29 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-05-13 16:48:26 +0200 |
commit | eca1b233322914d9013f3ee4aabecaadc9245abd (patch) | |
tree | 126995ad6720860662708debff842e46d46e79e2 /string/tst-memmove-overflow.c | |
parent | ad78d702757a189b1fa552d607e8aaa22252a45f (diff) | |
download | glibc-eca1b233322914d9013f3ee4aabecaadc9245abd.tar.gz glibc-eca1b233322914d9013f3ee4aabecaadc9245abd.tar.xz glibc-eca1b233322914d9013f3ee4aabecaadc9245abd.zip |
arm: XFAIL string/tst-memmove-overflow due to bug 25620
Also reduce the amount of output in case of a large-scale mismatch in the copied data. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'string/tst-memmove-overflow.c')
-rw-r--r-- | string/tst-memmove-overflow.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/string/tst-memmove-overflow.c b/string/tst-memmove-overflow.c index b744679ef4..77d693d0dd 100644 --- a/string/tst-memmove-overflow.c +++ b/string/tst-memmove-overflow.c @@ -57,6 +57,25 @@ expected_value (size_t index) return randomized >> 25; /* Result is in the range [0, 127]. */ } +/* Used to count mismatches up to a limit, to avoid creating a huge + test output file. */ +static unsigned int mismatch_count; + +/* Check ACTUAL == EXPECTED. Use INDEX for error reporting. Exit the + process after too many errors. */ +static inline void +check_one_index (size_t index, unsigned char actual, unsigned char expected) +{ + if (actual != expected) + { + printf ("error: mismatch at index %zu: expected 0x%02x, got 0x%02x\n", + index, actual, expected); + ++mismatch_count; + if (mismatch_count > 200) + FAIL_EXIT1 ("bailing out due to too many errors"); + } +} + static int test_main (void) { @@ -138,13 +157,13 @@ test_main (void) start + allocation_size - sizeof (expected_end) - 1, sizeof (expected_end)); for (size_t i = 0; i < unshared_size - 1; ++i) - TEST_COMPARE (start[i], expected_value (i + 1)); + check_one_index (i, start[i], expected_value (i + 1)); /* The gap between the checked start and end area of the mapping has shared mappings at unspecified boundaries, so do not check the expected values in the middle. */ for (size_t i = allocation_size - unshared_size; i < allocation_size - 1; ++i) - TEST_COMPARE (start[i], expected_value (i + 1)); + check_one_index (i, start[i], expected_value (i + 1)); support_blob_repeat_free (&repeat); } |