[2/8] Add test for "layout asm"
Commit Message
This adds a very simple test for "layout asm".
gdb/testsuite/ChangeLog
2019-07-21 Tom Tromey <tom@tromey.com>
* gdb.tui/basic.exp: Add "layout asm" test.
---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.tui/basic.exp | 10 ++++++++++
2 files changed, 14 insertions(+)
Comments
* Tom Tromey <tom@tromey.com> [2019-07-21 12:49:04 -0600]:
> This adds a very simple test for "layout asm".
>
> gdb/testsuite/ChangeLog
> 2019-07-21 Tom Tromey <tom@tromey.com>
>
> * gdb.tui/basic.exp: Add "layout asm" test.
> ---
> gdb/testsuite/ChangeLog | 4 ++++
> gdb/testsuite/gdb.tui/basic.exp | 10 ++++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp
> index 48d39741ba5..1eeeaa77606 100644
> --- a/gdb/testsuite/gdb.tui/basic.exp
> +++ b/gdb/testsuite/gdb.tui/basic.exp
> @@ -47,3 +47,13 @@ if {[regexp "21 *return 0" $text]} {
> # box.
> setup_xfail *-*-*
> Term::check_box "source box" 3 0 77 15
> +
> +Term::command "layout asm"
> +set text [Term::get_all_lines]
> +if {[regexp "$hex <main>" $text]} {
> + pass "asm window shows main"
> +} else {
> + fail "asm window shows main"
> +}
Wow! This is awesome! Hopefully this can really drive TUI testing
forward.
I noticed this pattern a lot in this series, I wonder if using
'gdb_assert' would be cleaner?
It even returns true/false so you can do (looking at patch #5 if in
the series):
if {![gdb_assert {[...condition]} "test name"]} {
Term::dump_screen
}
Thanks,
Andrew
> +
> +Term::check_box "asm box" 3 0 77 15
> --
> 2.17.2
>
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
Andrew> I noticed this pattern a lot in this series, I wonder if using
Andrew> 'gdb_assert' would be cleaner?
Thanks for mentioning this. I wasn't aware of gdb_assert.
I've made this change and I'll send the new series momentarily.
I'd like to land this soon, because my next round of TUI refactorings is
about ready to send, and it needs the tests.
Tom
@@ -47,3 +47,13 @@ if {[regexp "21 *return 0" $text]} {
# box.
setup_xfail *-*-*
Term::check_box "source box" 3 0 77 15
+
+Term::command "layout asm"
+set text [Term::get_all_lines]
+if {[regexp "$hex <main>" $text]} {
+ pass "asm window shows main"
+} else {
+ fail "asm window shows main"
+}
+
+Term::check_box "asm box" 3 0 77 15