From: "H.J. Lu" <hjl.tools@gmail.com>
To: Sunil K Pandey <skpgkp2@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2] Improve test coverage of strlen function
Date: Mon, 31 May 2021 09:02:58 -0700 [thread overview]
Message-ID: <CAMe9rOqds2agM_Vsi_jXPqYw83+iOyB8e7NWuAPf9bdADb79nQ@mail.gmail.com> (raw)
In-Reply-To: <20210531155938.421952-1-skpgkp2@gmail.com>
On Mon, May 31, 2021 at 8:59 AM Sunil K Pandey <skpgkp2@gmail.com> wrote:
>
> This patch covers following conditions.
"the following conditions:"
> - String starts with different alignments and ends at the page boundary
Strings start ... and end
> with less than 64 byte length.
> - String starts with different alignments and cross page boundary with
Strings starts
> fixed length.
> ---
> string/test-strlen.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/string/test-strlen.c b/string/test-strlen.c
> index 6e67d1f1f1..c9a7afb339 100644
> --- a/string/test-strlen.c
> +++ b/string/test-strlen.c
> @@ -79,7 +79,7 @@ do_test (size_t align, size_t len)
> {
> size_t i;
>
> - align &= 63;
> + align &= (getpagesize () / sizeof (CHAR)) - 1;
> if (align + sizeof (CHAR) * len >= page_size)
> return;
>
> @@ -160,6 +160,19 @@ test_main (void)
> do_test (sizeof (CHAR) * i, (size_t)((1 << i) / 1.5));
> }
>
> + /* Test strings near page boundary */
> +
> + size_t maxlength = 64 / sizeof (CHAR) - 1;
> + size_t pagesize = getpagesize () / sizeof (CHAR);
> +
> + for (i = maxlength ; i > 1; --i)
> + {
> + /* String stays on the same page. */
> + do_test (pagesize - i, i - 1);
> + /* String crosses page boundary. */
> + do_test (pagesize - i, maxlength);
> + }
> +
> do_random_tests ();
> return ret;
> }
> --
> 2.31.1
>
--
H.J.
prev parent reply other threads:[~2021-05-31 16:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 15:59 Sunil K Pandey
2021-05-31 16:02 ` H.J. Lu [this message]
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=CAMe9rOqds2agM_Vsi_jXPqYw83+iOyB8e7NWuAPf9bdADb79nQ@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=skpgkp2@gmail.com \
/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).