public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sunil Pandey <skpgkp2@gmail.com>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Improve test coverage of strnlen function
Date: Wed, 2 Jun 2021 13:57:09 -0700	[thread overview]
Message-ID: <CAMAf5_eMt3E2JWys9006LEhTN6AY1UzZAHcfs4T5OPjQ95hsEQ@mail.gmail.com> (raw)
In-Reply-To: <CAFUsyf+P2M9AyepfPp9fh2u9s5aWr_OmnZ_8hC1N3zz8fgT0mw@mail.gmail.com>

On Wed, Jun 2, 2021 at 10:33 AM Noah Goldstein <goldstein.w.n@gmail.com>
wrote:

> On Wed, Jun 2, 2021 at 1:26 PM Noah Goldstein <goldstein.w.n@gmail.com>
> wrote:
> >
> > On Wed, Jun 2, 2021 at 12:13 PM Sunil K Pandey via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> > >
> > > This patch covers the following condition:
> > >
> > > Strings start with different alignments and end with less than 512 byte
> > > length.
> > > ---
> > >  string/test-strnlen.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/string/test-strnlen.c b/string/test-strnlen.c
> > > index d70faa26ab..20e645893a 100644
> > > --- a/string/test-strnlen.c
> > > +++ b/string/test-strnlen.c
> > > @@ -271,6 +271,10 @@ test_main (void)
> > >        do_test (1, 1 << i, 5000, BIG_CHAR);
> > >      }
> > >
> > > +  for (i = 1; i <= 127; i++)
> >
> > I think it makes sense to either include 0 or 128 for alignments
> > as in some implementations (x86 avx2/evex for example)
> > that is a unique case.
> >
> > > +    for (size_t length = i; length < 512; length++)
> > > +      do_test (i, length, 512, BIG_CHAR);
> I think it would also make sense to include multiple length.
> Again in the x86_64 avx2/evex implementations for example
> there are 4 cases for handling remaining length:
>  [1,32], [33,64], [65,96], and [97, 128].
>
> As well it might be useful to have tests for position of
> null > length as well.
>
> >
> > Might be strengthened a bit with additional test case
> > in inner loop:
> > do_test (getpagesize() - i, length, 512, BIG_CHAR);
> >
> > > +
> > >    do_random_tests ();
> > >    do_page_tests ();
> > >    do_page_2_tests ();
> > > --
> > > 2.31.1
> > >
>
Sure, will submit a v2 patch which will incorporate all these cases.

      reply	other threads:[~2021-06-02 20:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 16:10 Sunil K Pandey
2021-06-02 17:26 ` Noah Goldstein
2021-06-02 17:33   ` Noah Goldstein
2021-06-02 20:57     ` Sunil Pandey [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=CAMAf5_eMt3E2JWys9006LEhTN6AY1UzZAHcfs4T5OPjQ95hsEQ@mail.gmail.com \
    --to=skpgkp2@gmail.com \
    --cc=goldstein.w.n@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).