public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* string: Add additional output in test-strchr failure
@ 2023-12-27 19:29 Noah Goldstein
  2023-12-27 19:32 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Goldstein @ 2023-12-27 19:29 UTC (permalink / raw)
  To: libc-alpha; +Cc: goldstein.w.n, hjl.tools, carlos

Seeing occasional failures in `__strchrnul_evex512` that are not
consistently reproducible. Hopefully by adding this the next failure
will provide enough information to debug.
---
 string/test-strchr.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/string/test-strchr.c b/string/test-strchr.c
index 933fc0bbba..e6bae76962 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -111,7 +111,7 @@ check_result (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
   CHAR *res = CALL (impl, s, c);
   if (res != exp_res)
     {
-      error (0, 0, "Wrong result in function %s %#x %p %p", impl->name,
+      error (0, 0, "Wrong result in function %s(%p) %#x %p %p", impl->name, s,
 	     c, res, exp_res);
       ret = 1;
       return -1;
@@ -119,11 +119,10 @@ check_result (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
   return 0;
 }
 
-static void
+static int
 do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
 {
-  if (check_result (impl, s, c, exp_res) < 0)
-    return;
+  return check_result (impl, s, c, exp_res);
 }
 
 static void
@@ -160,7 +159,15 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
     result = NULLRET (buf + align + len);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, buf + align, seek_char, result);
+    {
+      if (do_one_test (impl, buf + align, seek_char, result) != 0)
+	{
+	  error (0, 0,
+		 "\tAlign=%zu, Pos=%zu, Len=%zu, seek=%d, max_char=%d, "
+		 "Buf=%p, Res=%p",
+		 align, pos, len, seek_char, max_char, buf, result);
+	}
+    }
 }
 
 static void
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: string: Add additional output in test-strchr failure
  2023-12-27 19:29 string: Add additional output in test-strchr failure Noah Goldstein
@ 2023-12-27 19:32 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2023-12-27 19:32 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: libc-alpha, carlos

On Wed, Dec 27, 2023 at 11:29 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> Seeing occasional failures in `__strchrnul_evex512` that are not
> consistently reproducible. Hopefully by adding this the next failure
> will provide enough information to debug.
> ---
>  string/test-strchr.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/string/test-strchr.c b/string/test-strchr.c
> index 933fc0bbba..e6bae76962 100644
> --- a/string/test-strchr.c
> +++ b/string/test-strchr.c
> @@ -111,7 +111,7 @@ check_result (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
>    CHAR *res = CALL (impl, s, c);
>    if (res != exp_res)
>      {
> -      error (0, 0, "Wrong result in function %s %#x %p %p", impl->name,
> +      error (0, 0, "Wrong result in function %s(%p) %#x %p %p", impl->name, s,
>              c, res, exp_res);
>        ret = 1;
>        return -1;
> @@ -119,11 +119,10 @@ check_result (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
>    return 0;
>  }
>
> -static void
> +static int
>  do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
>  {
> -  if (check_result (impl, s, c, exp_res) < 0)
> -    return;
> +  return check_result (impl, s, c, exp_res);
>  }
>
>  static void
> @@ -160,7 +159,15 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
>      result = NULLRET (buf + align + len);
>
>    FOR_EACH_IMPL (impl, 0)
> -    do_one_test (impl, buf + align, seek_char, result);
> +    {
> +      if (do_one_test (impl, buf + align, seek_char, result) != 0)
> +       {
> +         error (0, 0,
> +                "\tAlign=%zu, Pos=%zu, Len=%zu, seek=%d, max_char=%d, "
> +                "Buf=%p, Res=%p",
> +                align, pos, len, seek_char, max_char, buf, result);
> +       }
> +    }
>  }
>
>  static void
> --
> 2.34.1
>

LGTM.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-27 19:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-27 19:29 string: Add additional output in test-strchr failure Noah Goldstein
2023-12-27 19:32 ` H.J. Lu

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).