public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Noah Goldstein <nwg@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] string: Add additional output in test-strchr failure
Date: Tue,  2 Jan 2024 05:27:17 +0000 (GMT)	[thread overview]
Message-ID: <20240102052717.139003858D1E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4b00532e51e40e2a85eba65ed817234b7bd741d9

commit 4b00532e51e40e2a85eba65ed817234b7bd741d9
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Wed Dec 27 11:29:32 2023 -0800

    string: Add additional output in test-strchr failure
    
    Seeing occasional failures in `__strchrnul_evex512` that are not
    consistently reproducible. Hopefully by adding this the next failure
    will provide enough information to debug.
    
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 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 f850fcbe26..c795eac6fa 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

                 reply	other threads:[~2024-01-02  5:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240102052717.139003858D1E@sourceware.org \
    --to=nwg@sourceware.org \
    --cc=glibc-cvs@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).