public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@axis.com>
To: <gcc-patches@gcc.gnu.org>, <dmalcolm@redhat.com>
Subject: [PATCH] testsuite: Don't include multiline regexps in the the pass/fail log
Date: Fri, 24 Feb 2023 18:54:33 +0100	[thread overview]
Message-ID: <20230224175433.CF5002043D@pchp3.se.axis.com> (raw)

Ok to commit?

-- >8 --
I see overlong lines in the output when a test fails, for
example for a bug exposed for cris-elf and pru-elf in
gcc.dg/analyzer/allocation-size-multiline-3.c:

Running /x/gcc/testsuite/gcc.dg/analyzer/analyzer.exp ...
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 16-25 not found: "\s*int32_t \*ptr = alloca \(99\);[^\n\r]*\n                  \^~~~~~\n  'test_constant_99': events 1-2[^\n\r]*\n    \|[^\n\r]*\n    \|   int32_t \*ptr = alloca \(99\);[^\n\r]*\n    \|                  \^~~~~~\n    \|                  \|[^\n\r]*\n    \|                  \(1\) allocated 99 bytes here[^\n\r]*\n    \|                  \(2\) assigned to 'int32_t \*' \{aka 'int \*'\} here; 'sizeof \(int32_t \{aka int\}\)' is '4'[^\n\r]*\n    \|[^\n\r]*\n"
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 34-43 not found: "   int32_t \*ptr = alloca \(n \* 2\);[^\n\r]*\n                  \^~~~~~\n  'test_symbolic': events 1-2[^\n\r]*\n    \|[^\n\r]*\n    \|   int32_t \*ptr = alloca \(n \* 2\);[^\n\r]*\n    \|                  \^~~~~~\n    \|                  \|[^\n\r]*\n    \|                  \(1\) allocated 'n \* 2' bytes here[^\n\r]*\n    \|                  \(2\) assigned to 'int32_t \*' \{aka 'int \*'\} here; 'sizeof \(int32_t \{aka int\}\)' is '4'[^\n\r]*\n    \|[^\n\r]*\n"
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c (test for excess errors)

That multiline-regexp-quoted-on-a-single-line is redundant
when also outputting "lines 16-25" and "lines 34-43".  It's
also so noisy that it can be mistaken for a testsuite error.
If there's a need to inspect it, it can be seen at
verbose-level 4, i.e. persons interested in seeing it
without editing sources can just add "-v -v -v -v".

Let's "prune" the regexp from regular output, instead producing:
Running /x/gcc/testsuite/gcc.dg/analyzer/analyzer.exp ...
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 16-25 not found
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 34-43 not found
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c (test for excess errors)

	* lib/multiline.exp (handle-multiline-outputs): Don't include the
	quoted multiline regexp in the pass/fail output.
---
 gcc/testsuite/lib/multiline.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index 84ba9216642e..5eccf2bbebc1 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -169,9 +169,9 @@ proc handle-multiline-outputs { text } {
 	# Use "regsub" to attempt to prune the pattern from $text
 	if {[regsub -line $rexp $text "" text]} {
 	    # The multiline pattern was pruned.
-	    ${maybe_x}pass "$title was found: \"$escaped_regex\""
+	    ${maybe_x}pass "$title was found"
 	} else {
-	    ${maybe_x}fail "$title not found: \"$escaped_regex\""
+	    ${maybe_x}fail "$title not found"
 	}
 
 	set index [expr $index + 1]
-- 
2.30.2


             reply	other threads:[~2023-02-24 17:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 17:54 Hans-Peter Nilsson [this message]
2023-02-24 19:07 ` David Malcolm
2023-02-25 19:59   ` [PATCH] testsuite: Don't include multiline patterns " Hans-Peter Nilsson
2023-02-27 17:41 ` [PATCH] testsuite: Don't include multiline regexps " Mike Stump
2023-02-27 17:59   ` Hans-Peter Nilsson
2023-02-27 18:48     ` Mike Stump

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=20230224175433.CF5002043D@pchp3.se.axis.com \
    --to=hp@axis.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.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).