public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Make tui testing less verbose
@ 2021-10-05 13:22 Tom de Vries
  2021-10-05 18:12 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2021-10-05 13:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Hi,

Currently, tui testing is rather verbose.  When using these RUNTESTFLAGS to
pick up all tui tests (17 in total):
...
rtf=$(echo $(cd src/gdb/testsuite/; find gdb.* -type f -name *.exp* \
  | xargs grep -l tuiterm_env) )
...
we have:
...
$ wc -l gdb.log
120592 gdb.log
...

Most of the output is related to controlling the tui screen, but that does
not give a top-level sense of how the test-case progresses.

Put differently: a lot of bandwith is used to describe how we arrive at a
certain tui screen state.  But we don't actually always show the state we
arrive at, unless there's a FAIL.

And if there's say, a PASS that should actually be FAILing, it's hard to
detect.

Fix this by:
- dropping the -log on the call to verbose in _log.  We still can get the
  same info back using runtest -v.
- dumping the screen or box that we're checking, also when the test passes.

Brings down verbosity to something more reasonable:
...
$ wc -l gdb.log
3221 gdb.log
...

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Make tui testing less verbose

---
 gdb/testsuite/lib/tuiterm.exp | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index a0197402b1f..149b7515d49 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -34,7 +34,7 @@ namespace eval Term {
     variable _resize_count
 
     proc _log { what } {
-	verbose -log "+++ $what"
+	verbose "+++ $what"
     }
 
     # Call BODY, then log WHAT along with the original and new cursor position.
@@ -754,11 +754,11 @@ namespace eval Term {
 
     # Check for a box at the given coordinates.
     proc check_box {test_name x y width height} {
+	dump_box $x $y $width $height
 	set why [_check_box $x $y $width $height]
 	if {$why == ""} {
 	    pass $test_name
 	} else {
-	    dump_screen
 	    fail "$test_name ($why)"
 	}
     }
@@ -766,10 +766,9 @@ namespace eval Term {
     # Check whether the text contents of the terminal match the
     # regular expression.  Note that text styling is not considered.
     proc check_contents {test_name regexp} {
+	dump_screen
 	set contents [get_all_lines]
-	if {![gdb_assert {[regexp -- $regexp $contents]} $test_name]} {
-	    dump_screen
-	}
+	gdb_assert {[regexp -- $regexp $contents]} $test_name
     }
 
     # Get the region of the screen described by X, Y, WIDTH,
@@ -800,13 +799,12 @@ namespace eval Term {
     # choice for boxes with a border).
     proc check_region_contents { test_name x y width height regexp } {
 	variable _chars
+	dump_box $x $y $width $height
 
 	# Now grab the contents of the box, join each line together
 	# with a '\r\n' sequence and match against REGEXP.
 	set result [get_region $x $y $width $height "\r\n"]
-	if {![gdb_assert {[regexp -- $regexp $result]} $test_name]} {
-	    dump_screen
-	}
+	gdb_assert {[regexp -- $regexp $result]} $test_name
     }
 
     # Check the contents of a box on the screen.  This is a little
@@ -818,9 +816,9 @@ namespace eval Term {
     proc check_box_contents {test_name x y width height regexp} {
 	variable _chars
 
+	dump_box $x $y $width $height
 	set why [_check_box $x $y $width $height]
 	if {$why != ""} {
-	    dump_screen
 	    fail "$test_name (box check: $why)"
 	    return
 	}

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

* Re: [PATCH][gdb/testsuite] Make tui testing less verbose
  2021-10-05 13:22 [PATCH][gdb/testsuite] Make tui testing less verbose Tom de Vries
@ 2021-10-05 18:12 ` Tom Tromey
  2021-10-05 23:32   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2021-10-05 18:12 UTC (permalink / raw)
  To: Tom de Vries via Gdb-patches; +Cc: Tom de Vries, Tom Tromey

>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> Brings down verbosity to something more reasonable:
Tom> ...
Tom> $ wc -l gdb.log
Tom> 3221 gdb.log
Tom> ...

Tom> Tested on x86_64-linux.

Tom> Any comments?

It seems fine to me.  I don't know what others do, but when I'm
debugging TUI test cases I normally end up hacking in a bunch of
dump_screen calls or whatever, as needed, then remove them at the end.
So I'd probably be fine with even less logging.

Tom

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

* Re: [PATCH][gdb/testsuite] Make tui testing less verbose
  2021-10-05 18:12 ` Tom Tromey
@ 2021-10-05 23:32   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2021-10-05 23:32 UTC (permalink / raw)
  To: Tom Tromey, Tom de Vries via Gdb-patches

On 10/5/21 8:12 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Tom> Brings down verbosity to something more reasonable:
> Tom> ...
> Tom> $ wc -l gdb.log
> Tom> 3221 gdb.log
> Tom> ...
> 
> Tom> Tested on x86_64-linux.
> 
> Tom> Any comments?
> 
> It seems fine to me.  I don't know what others do, but when I'm
> debugging TUI test cases I normally end up hacking in a bunch of
> dump_screen calls or whatever, as needed, then remove them at the end.

I do the same, and my ambition here was to make adding those calls
superfluous.

> So I'd probably be fine with even less logging.

Ack, but perhaps for maintainers less experienced with TUI test-cases
it'll be easier to parse the initial log and analyze problems (without
requiring them to know where to add those calls).

Thanks,
- Tom

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

end of thread, other threads:[~2021-10-05 23:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 13:22 [PATCH][gdb/testsuite] Make tui testing less verbose Tom de Vries
2021-10-05 18:12 ` Tom Tromey
2021-10-05 23:32   ` Tom de Vries

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