public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] string: Expand page cross test cases in test-strncmp.c
@ 2022-03-25 18:19 Noah Goldstein
  0 siblings, 0 replies; only message in thread
From: Noah Goldstein @ 2022-03-25 18:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=39399913a244a911edb1ff1e31dfe38e64177bb5

commit 39399913a244a911edb1ff1e31dfe38e64177bb5
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Wed Mar 23 16:57:40 2022 -0500

    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>

Diff:
---
 string/test-strncmp.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/string/test-strncmp.c b/string/test-strncmp.c
index 1a87f0e73e..bba9e3d2dc 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-25 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 18:19 [glibc] string: Expand page cross test cases in test-strncmp.c Noah Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).