* [PATCH v3] Improve test coverage of strlen function
@ 2021-05-31 18:08 Sunil K Pandey
2021-05-31 18:21 ` H.J. Lu
0 siblings, 1 reply; 4+ messages in thread
From: Sunil K Pandey @ 2021-05-31 18:08 UTC (permalink / raw)
To: libc-alpha
This patch covers the following conditions:
- Strings start with different alignments and end at the page boundary
with less than 64 byte length.
- Strings starts with different alignments and cross page boundary with
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] Improve test coverage of strlen function
2021-05-31 18:08 [PATCH v3] Improve test coverage of strlen function Sunil K Pandey
@ 2021-05-31 18:21 ` H.J. Lu
2021-06-02 12:40 ` H.J. Lu
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2021-05-31 18:21 UTC (permalink / raw)
To: Sunil K Pandey; +Cc: GNU C Library
On Mon, May 31, 2021 at 11:08 AM Sunil K Pandey <skpgkp2@gmail.com> wrote:
>
> This patch covers the following conditions:
>
> - Strings start with different alignments and end at the page boundary
> with less than 64 byte length.
> - Strings starts with different alignments and cross page boundary with
> 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
>
LGTM.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] Improve test coverage of strlen function
2021-05-31 18:21 ` H.J. Lu
@ 2021-06-02 12:40 ` H.J. Lu
2021-06-02 17:51 ` Sunil Pandey
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2021-06-02 12:40 UTC (permalink / raw)
To: Sunil K Pandey, GNU C Library
On Mon, May 31, 2021 at 11:21:50AM -0700, H.J. Lu wrote:
> On Mon, May 31, 2021 at 11:08 AM Sunil K Pandey <skpgkp2@gmail.com> wrote:
> >
> > This patch covers the following conditions:
> >
> > - Strings start with different alignments and end at the page boundary
> > with less than 64 byte length.
> > - Strings starts with different alignments and cross page boundary with
> > 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
> >
>
> LGTM.
>
> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
>
Hi Sunil,
I am checking it in for you. Please get an account on sourceware.org:
https://sourceware.org/
and use me as sponsor.
Thanks.
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] Improve test coverage of strlen function
2021-06-02 12:40 ` H.J. Lu
@ 2021-06-02 17:51 ` Sunil Pandey
0 siblings, 0 replies; 4+ messages in thread
From: Sunil Pandey @ 2021-06-02 17:51 UTC (permalink / raw)
To: H.J. Lu; +Cc: GNU C Library
Hi,
I am an Intel employee, working on glibc for x86. I have an
account(skpgkp2) on sourceware.org.
Can someone please tell me how to get write access to glibc git repo.
Thanks,
Sunil Pandey
On Wed, Jun 2, 2021 at 5:40 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, May 31, 2021 at 11:21:50AM -0700, H.J. Lu wrote:
> > On Mon, May 31, 2021 at 11:08 AM Sunil K Pandey <skpgkp2@gmail.com>
> wrote:
> > >
> > > This patch covers the following conditions:
> > >
> > > - Strings start with different alignments and end at the page boundary
> > > with less than 64 byte length.
> > > - Strings starts with different alignments and cross page boundary with
> > > 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
> > >
> >
> > LGTM.
> >
> > Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
> >
>
> Hi Sunil,
>
> I am checking it in for you. Please get an account on sourceware.org:
>
> https://sourceware.org/
>
> and use me as sponsor.
>
> Thanks.
>
> H.J.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-02 17:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 18:08 [PATCH v3] Improve test coverage of strlen function Sunil K Pandey
2021-05-31 18:21 ` H.J. Lu
2021-06-02 12:40 ` H.J. Lu
2021-06-02 17:51 ` Sunil Pandey
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).