diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2022-03-23 16:57:40 -0500 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2022-03-25 11:46:14 -0500 |
commit | 39399913a244a911edb1ff1e31dfe38e64177bb5 (patch) | |
tree | ca9d9e206f0f9937d46a0fe04c274eb2bb0543d9 | |
parent | 22833848e3a2ef3bebef088cea7fcf281972672a (diff) | |
download | glibc-39399913a244a911edb1ff1e31dfe38e64177bb5.zip glibc-39399913a244a911edb1ff1e31dfe38e64177bb5.tar.gz glibc-39399913a244a911edb1ff1e31dfe38e64177bb5.tar.bz2 |
string: Expand page cross test cases in test-strncmp.c
Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
-rw-r--r-- | string/test-strncmp.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/string/test-strncmp.c b/string/test-strncmp.c index 1a87f0e..bba9e3d 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -573,7 +573,7 @@ check_overflow (void) int test_main (void) { - size_t i, j; + size_t i, j, k; const size_t test_len = MIN(TEST_LEN, 3 * 4096); test_init (); @@ -705,6 +705,31 @@ test_main (void) do_test_n (j, getpagesize () - j - 1, i, ULONG_MAX - i, 0, 127, 0); do_test_n (j, getpagesize () - j - 1, i, ULONG_MAX - i, 0, 127, 1); do_test_n (j, getpagesize () - j - 1, i, ULONG_MAX - i, 0, 127, -1); + + for (k = 2; k <= 128; k += k) + { + do_test (getpagesize () - k, getpagesize () - j - 1, i - 1, i, + 127, 0); + do_test (getpagesize () - k - 1, getpagesize () - j - 1, i - 1, + i, 127, 0); + do_test (getpagesize () - k, getpagesize () - j - 1, i + 1, i, + 127, 0); + do_test (getpagesize () - k - 1, getpagesize () - j - 1, i + 1, + i, 127, 0); + do_test (getpagesize () - k, getpagesize () - j - 1, i, i, 127, + 0); + do_test (getpagesize () - k - 1, getpagesize () - j - 1, i, i, + 127, 0); + do_test (getpagesize () - k, getpagesize () - j - 1, i + 1, i, + 127, -1); + do_test (getpagesize () - k - 1, getpagesize () - j - 1, i + 1, + i, 127, -1); + do_test (getpagesize () - k, getpagesize () - j - 1, i + 1, i, + 127, 1); + do_test (getpagesize () - k - 1, getpagesize () - j - 1, i + 1, + i, 127, 1); + } + if (i < 32) { i += 1; |