public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Noah Goldstein <nwg@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] string: Expand page cross test cases in test-strncmp.c
Date: Fri, 25 Mar 2022 18:19:17 +0000 (GMT)	[thread overview]
Message-ID: <20220325181917.DF5C23857404@sourceware.org> (raw)

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;


                 reply	other threads:[~2022-03-25 18:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220325181917.DF5C23857404@sourceware.org \
    --to=nwg@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).