aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-01-07 00:35:02 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-01-09 23:11:44 +0000
commit3804da7e07a13c14210d79de55ebfe2318421164 (patch)
tree554be6e90a1ea98219e32654beebf5bdfb4e5dcf /gdb
parentb40aa28fb5de5e84bd3409f54138def0ba904a9a (diff)
downloadgdb-3804da7e07a13c14210d79de55ebfe2318421164.zip
gdb-3804da7e07a13c14210d79de55ebfe2318421164.tar.gz
gdb-3804da7e07a13c14210d79de55ebfe2318421164.tar.bz2
gdb/testsuite/tui: Introduce check_box_contents
A new test procedure for matching the contents of one screen box against a regexp. This can be used to match the contents of one TUI window against a regexp without any of the borders, or other windows being included in the matched output (as is currently the case with check_contents). This will be used in a later commit. gdb/testsuite/ChangeLog: * lib/tuiterm.exp (Term::check_box_contents): New proc. Change-Id: Icf795bf38dd9295e282a34eecc318a9cdbc73926
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/lib/tuiterm.exp31
2 files changed, 35 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7d8c8d0..78880be 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+ * lib/tuiterm.exp (Term::check_box_contents): New proc.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
* lib/tuiterm.exp (Term::prepare_for_tui): New proc.
(Term::enter_tui): Use Term::prepare_for_tui.
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 9ac599b..0307745 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -600,6 +600,37 @@ namespace eval Term {
}
}
+ # Check the contents of a box on the screen. This is a little
+ # like check_contents, but doens't check the whole screen
+ # contents, only the contents of a single box. This procedure
+ # includes (effectively) a call to check_box to ensure there is a
+ # box where expected, if there is then the contents of the box are
+ # matched against REGEXP.
+ proc check_box_contents {test_name x y width height regexp} {
+ variable _chars
+
+ set why [_check_box $x $y $width $height]
+ if {$why != ""} {
+ dump_screen
+ fail "$test_name (box check: $why)"
+ return
+ }
+
+ # Now grab the contents of the box, join each line together
+ # with a newline character and match against REGEXP.
+ set result ""
+ for {set yy [expr {$y + 1}]} {$yy < [expr {$y + $height - 1}]} {incr yy} {
+ for {set xx [expr {$x + 1}]} {$xx < [expr {$x + $width - 1}]} {incr xx} {
+ append result [lindex $_chars($xx,$yy) 0]
+ }
+ append result "\n"
+ }
+
+ if {![gdb_assert {[regexp -- $regexp $result]} $test_name]} {
+ dump_screen
+ }
+ }
+
# A debugging function to dump the current screen, with line
# numbers.
proc dump_screen {} {