public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb/testsuite: add some logging in Term::_check_box
Date: Tue,  8 Jun 2021 15:43:06 -0400	[thread overview]
Message-ID: <20210608194306.1636782-1-simon.marchi@polymtl.ca> (raw)

I was diagnosing some problem with a TUI test case, which lead me to
improve the logging of _check_box a bit.  It did help me, so I think it
would be nice to have it upstream.

gdb/testsuite/ChangeLog:

	* lib/tuiterm.exp (Term) <_check_box>: Improve logging.

Change-Id: I887e83c02507d6c59c991e17f795c844ed63bacf
---
 gdb/testsuite/lib/tuiterm.exp | 46 +++++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 3f6271ef0ea0..fdd9f4d2188f 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -729,17 +729,26 @@ namespace eval Term {
 	set x2 [expr {$x + $width - 1}]
 	set y2 [expr {$y + $height - 1}]
 
-	if {[get_char $x $y] != "+"} {
-	    return "ul corner"
+	verbose -log "_check_box x=$x, y=$y, x2=$x2, y2=$y2, width=$width, height=$height"
+
+	set c [get_char $x $y]
+	if {$c != "+"} {
+	    return "ul corner is $c, not +"
 	}
-	if {[get_char $x $y2] != "+"} {
-	    return "ll corner"
+
+	set c [get_char $x $y2]
+	if {$c != "+"} {
+	    return "ll corner is $c, not +"
 	}
-	if {[get_char $x2 $y] != "+"} {
-	    return "ur corner"
+
+	set c [get_char $x2 $y]
+	if {$c != "+"} {
+	    return "ur corner is $c, not +"
 	}
-	if {[get_char $x2 $y2] != "+"} {
-	    return "lr corner"
+
+	set c [get_char $x2 $y2]
+	if {$c != "+"} {
+	    return "lr corner is $c, not +"
 	}
 
 	# Note we do not check the full horizonal borders of the box.
@@ -747,21 +756,26 @@ namespace eval Term {
 	# it is overlapped by some other border.  However, at most a
 	# title should appear as '+-VERY LONG TITLE-+', so we can
 	# check for the '+-' on the left, and '-+' on the right.
-	if {[get_char [expr {$x + 1}] $y] != "-"} {
-	    return "ul title padding"
+	set c [get_char [expr {$x + 1}] $y]
+	if {$c != "-"} {
+	    return "ul title padding is $c, not -"
 	}
 
-	if {[get_char [expr {$x2 - 1}] $y] != "-"} {
-	    return "ul title padding"
+	set c [get_char [expr {$x2 - 1}] $y]
+	if {$c != "-"} {
+	    return "ul title padding is $c, not -"
 	}
 
 	# Now check the vertical borders.
 	for {set i [expr {$y + 1}]} {$i < $y2 - 1} {incr i} {
-	    if {[get_char $x $i] != "|"} {
-		return "left side $i"
+	    set c [get_char $x $i]
+	    if {$c != "|"} {
+		return "left side $i is $c, not |"
 	    }
-	    if {[get_char $x2 $i] != "|"} {
-		return "right side $i"
+
+	    set c [get_char $x2 $i]
+	    if {$c != "|"} {
+		return "right side $i is $c, not |"
 	    }
 	}
 
-- 
2.31.1


             reply	other threads:[~2021-06-08 19:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 19:43 Simon Marchi [this message]
2021-06-09 14:45 ` Tom Tromey
2021-06-09 14:54   ` Simon Marchi

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=20210608194306.1636782-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@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).