diff mbox series

String: Improve test coverage for memchr

Message ID 20221010164842.453596-1-skpgkp2@gmail.com
State New
Headers show
Series String: Improve test coverage for memchr | expand

Commit Message

Sunil Pandey Oct. 10, 2022, 4:48 p.m. UTC
This test improves memchr coverage near page boundary.
---
 string/test-memchr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

H.J. Lu Oct. 10, 2022, 4:52 p.m. UTC | #1
On Mon, Oct 10, 2022 at 9:49 AM Sunil K Pandey via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> This test improves memchr coverage near page boundary.
> ---
>  string/test-memchr.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/string/test-memchr.c b/string/test-memchr.c
> index 279a67ebe6..1cbcd57fd4 100644
> --- a/string/test-memchr.c
> +++ b/string/test-memchr.c
> @@ -247,8 +247,11 @@ test_main (void)
>    /* BZ#21182 - wrong overflow calculation for i686 implementation
>       with address near end of the page.  */
>    for (i = 2; i < 16; ++i)
> -    /* page_size is in fact getpagesize() * 2.  */
> -    do_test (page_size / 2 - i, i, i, 1, 0x9B);
> +    {
> +      /* page_size is in fact getpagesize() * 2.  */
> +      do_test (page_size / 2 - i, i, i, 1, 0x9B);
> +      do_test (page_size / 2 - i, i - 1, i - 1, 1, 0x9B);
> +    }
>
>    do_random_tests ();
>    do_overflow_tests ();
> --
> 2.36.1
>

LGTM.

Thanks.
diff mbox series

Patch

diff --git a/string/test-memchr.c b/string/test-memchr.c
index 279a67ebe6..1cbcd57fd4 100644
--- a/string/test-memchr.c
+++ b/string/test-memchr.c
@@ -247,8 +247,11 @@  test_main (void)
   /* BZ#21182 - wrong overflow calculation for i686 implementation
      with address near end of the page.  */
   for (i = 2; i < 16; ++i)
-    /* page_size is in fact getpagesize() * 2.  */
-    do_test (page_size / 2 - i, i, i, 1, 0x9B);
+    {
+      /* page_size is in fact getpagesize() * 2.  */
+      do_test (page_size / 2 - i, i, i, 1, 0x9B);
+      do_test (page_size / 2 - i, i - 1, i - 1, 1, 0x9B);
+    }
 
   do_random_tests ();
   do_overflow_tests ();