public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sunil K Pandey <skpgkp2@gmail.com>
To: libc-alpha@sourceware.org
Subject: [PATCH v2] Improve test coverage of strnlen function
Date: Wed,  2 Jun 2021 14:00:22 -0700	[thread overview]
Message-ID: <20210602210022.1091086-1-skpgkp2@gmail.com> (raw)

This patch covers the following condition:

Strings start with different alignments and end with length less than or
equal to 512 byte.
---
 string/test-strnlen.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index d70faa26ab..fc2519614f 100644
--- a/string/test-strnlen.c
+++ b/string/test-strnlen.c
@@ -271,6 +271,15 @@ test_main (void)
       do_test (1, 1 << i, 5000, BIG_CHAR);
     }
 
+  size_t pagesize = getpagesize () / sizeof (CHAR);
+
+  for (i = 0; i <= 127; i++)
+    for (size_t length = i; length <= 512; length++)
+      {
+	do_test (i, length, 512, BIG_CHAR);
+	do_test (pagesize - i, length, 512, BIG_CHAR);
+      }
+
   do_random_tests ();
   do_page_tests ();
   do_page_2_tests ();
-- 
2.31.1


             reply	other threads:[~2021-06-02 21:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 21:00 Sunil K Pandey [this message]
2021-06-02 21:18 ` Noah Goldstein

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=20210602210022.1091086-1-skpgkp2@gmail.com \
    --to=skpgkp2@gmail.com \
    --cc=libc-alpha@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).