From 581bea2c99751391fc49d104d5eacb85bfb63c96 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Wed, 17 Jun 2020 21:57:16 -0700 Subject: [PATCH] Fix TUI support checks in gdb.tui tests. 2020-06-17 Sandra Loosemore gdb/testsuite/ * gdb.tui/basic.exp: Skip test when TUI is unsupported, don't just say UNSUPPORTED. * gdb.tui/corefile-run.exp: Likewise. * gdb.tui/empty.exp: Likewise. * gdb.tui/list-before.exp: Likewise. * gdb.tui/list.exp: Likewise. * gdb.tui/main.exp: Likewise. * gdb.tui/regs.exp: Likewise. * gdb.tui/resize.exp: Likewise. * gdb.tui/tui-layout-asm-short-prog.exp: Likewise. * gdb.tui/tui-layout-asm.exp: Likewise. * gdb.tui/tui-missing-src.exp: Likewise. * gdb.tui/winheight.exp: Likewise. * gdb.tui/new-layout.exp: Likewise. Also move check earlier. --- gdb/testsuite/ChangeLog | 19 +++++++++++++++++++ gdb/testsuite/gdb.tui/basic.exp | 1 + gdb/testsuite/gdb.tui/corefile-run.exp | 1 + gdb/testsuite/gdb.tui/empty.exp | 1 + gdb/testsuite/gdb.tui/list-before.exp | 1 + gdb/testsuite/gdb.tui/list.exp | 1 + gdb/testsuite/gdb.tui/main.exp | 1 + gdb/testsuite/gdb.tui/new-layout.exp | 8 ++++++++ gdb/testsuite/gdb.tui/regs.exp | 1 + gdb/testsuite/gdb.tui/resize.exp | 1 + .../gdb.tui/tui-layout-asm-short-prog.exp | 1 + gdb/testsuite/gdb.tui/tui-layout-asm.exp | 1 + gdb/testsuite/gdb.tui/tui-missing-src.exp | 1 + gdb/testsuite/gdb.tui/winheight.exp | 1 + 14 files changed, 39 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2cdd2ea580..0e1dc5aaf1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2020-06-17 Sandra Loosemore + + Fix TUI support checks in gdb.tui tests. + + * gdb.tui/basic.exp: Skip test when TUI is unsupported, don't + just say UNSUPPORTED. + * gdb.tui/corefile-run.exp: Likewise. + * gdb.tui/empty.exp: Likewise. + * gdb.tui/list-before.exp: Likewise. + * gdb.tui/list.exp: Likewise. + * gdb.tui/main.exp: Likewise. + * gdb.tui/regs.exp: Likewise. + * gdb.tui/resize.exp: Likewise. + * gdb.tui/tui-layout-asm-short-prog.exp: Likewise. + * gdb.tui/tui-layout-asm.exp: Likewise. + * gdb.tui/tui-missing-src.exp: Likewise. + * gdb.tui/winheight.exp: Likewise. + * gdb.tui/new-layout.exp: Likewise. Also move check earlier. + 2020-06-17 Sandra Loosemore Fix TCL error in gdb.python/py-format-string.exp. diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp index 3e013a9515..0296e54286 100644 --- a/gdb/testsuite/gdb.tui/basic.exp +++ b/gdb/testsuite/gdb.tui/basic.exp @@ -26,6 +26,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { Term::clean_restart 24 80 $testfile if {![Term::enter_tui]} { unsupported "TUI not supported" + return } set text [Term::get_all_lines] diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp index 1878770bdc..94a599e897 100644 --- a/gdb/testsuite/gdb.tui/corefile-run.exp +++ b/gdb/testsuite/gdb.tui/corefile-run.exp @@ -47,6 +47,7 @@ if { ![gdb_gcore_cmd "$core" "save a corefile"] } { Term::clean_restart 24 80 $testfile if {![Term::enter_tui]} { unsupported "TUI not supported" + return } set text [Term::get_all_lines] diff --git a/gdb/testsuite/gdb.tui/empty.exp b/gdb/testsuite/gdb.tui/empty.exp index 89f49d6b7f..50c8be42f5 100644 --- a/gdb/testsuite/gdb.tui/empty.exp +++ b/gdb/testsuite/gdb.tui/empty.exp @@ -23,6 +23,7 @@ Term::clean_restart 24 80 if {![Term::enter_tui]} { unsupported "TUI not supported" + return } # Each entry describes a layout. It has these items: diff --git a/gdb/testsuite/gdb.tui/list-before.exp b/gdb/testsuite/gdb.tui/list-before.exp index 9c5eb5655e..fce745db7e 100644 --- a/gdb/testsuite/gdb.tui/list-before.exp +++ b/gdb/testsuite/gdb.tui/list-before.exp @@ -29,6 +29,7 @@ gdb_test "list main" if {![Term::enter_tui]} { unsupported "TUI not supported" + return } Term::check_contents "initial source listing" "21 *return 0" diff --git a/gdb/testsuite/gdb.tui/list.exp b/gdb/testsuite/gdb.tui/list.exp index b1e59499c8..77dbd69efd 100644 --- a/gdb/testsuite/gdb.tui/list.exp +++ b/gdb/testsuite/gdb.tui/list.exp @@ -26,6 +26,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { Term::clean_restart 24 80 $testfile if {![Term::enter_tui]} { unsupported "TUI not supported" + return } Term::check_contents "initial source listing" "21 *return 0" diff --git a/gdb/testsuite/gdb.tui/main.exp b/gdb/testsuite/gdb.tui/main.exp index fd3c2cd815..38e2e5bc72 100644 --- a/gdb/testsuite/gdb.tui/main.exp +++ b/gdb/testsuite/gdb.tui/main.exp @@ -31,6 +31,7 @@ gdb_test_no_output "set interactive-mode off" if {![Term::enter_tui]} { unsupported "TUI not supported" + return } Term::command "file [standard_output_file $testfile]" diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp index 3ea4dd4069..b4fca674e8 100644 --- a/gdb/testsuite/gdb.tui/new-layout.exp +++ b/gdb/testsuite/gdb.tui/new-layout.exp @@ -23,6 +23,13 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { return -1 } +# Make sure TUI is supported before continuing. +Term::clean_restart 24 80 $testfile +if {![Term::enter_tui]} { + unsupported "TUI not supported" + return +} + Term::clean_restart 24 80 $testfile gdb_test "tui new-layout" \ @@ -59,6 +66,7 @@ gdb_test "help layout h" \ if {![Term::enter_tui]} { unsupported "TUI not supported" + return } set text [Term::get_all_lines] diff --git a/gdb/testsuite/gdb.tui/regs.exp b/gdb/testsuite/gdb.tui/regs.exp index a9296a7d5f..3d635236e8 100644 --- a/gdb/testsuite/gdb.tui/regs.exp +++ b/gdb/testsuite/gdb.tui/regs.exp @@ -32,6 +32,7 @@ if {![runto_main]} { if {![Term::enter_tui]} { unsupported "TUI not supported" + return } Term::check_contents "source at startup" "\\|.*21 *return 0" diff --git a/gdb/testsuite/gdb.tui/resize.exp b/gdb/testsuite/gdb.tui/resize.exp index fd1b35088a..bf32251c45 100644 --- a/gdb/testsuite/gdb.tui/resize.exp +++ b/gdb/testsuite/gdb.tui/resize.exp @@ -32,6 +32,7 @@ if {![runto_main]} { if {![Term::enter_tui]} { unsupported "TUI not supported" + return } Term::check_contents "source at startup" "\\|.*21 *return 0" diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp index 50cb61f0fa..1a7992502a 100644 --- a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp +++ b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp @@ -29,6 +29,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile} \ Term::clean_restart 24 80 $testfile if {![Term::prepare_for_tui]} { unsupported "TUI not supported" + return } # This puts us into TUI mode, and should display the ASM window. diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm.exp b/gdb/testsuite/gdb.tui/tui-layout-asm.exp index 44f7a3a3a4..96fb043321 100644 --- a/gdb/testsuite/gdb.tui/tui-layout-asm.exp +++ b/gdb/testsuite/gdb.tui/tui-layout-asm.exp @@ -27,6 +27,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { Term::clean_restart 24 80 $testfile if {![Term::prepare_for_tui]} { unsupported "TUI not supported" + return } # This puts us into TUI mode, and should display the ASM window. diff --git a/gdb/testsuite/gdb.tui/tui-missing-src.exp b/gdb/testsuite/gdb.tui/tui-missing-src.exp index 6b5c7fad4c..a8460c6514 100644 --- a/gdb/testsuite/gdb.tui/tui-missing-src.exp +++ b/gdb/testsuite/gdb.tui/tui-missing-src.exp @@ -75,6 +75,7 @@ file delete $mainfile Term::clean_restart 24 80 $testfile if {![Term::enter_tui]} { unsupported "TUI not supported" + return } # There must exist a source layout with the size 80x15 and # there should be nothing in it. diff --git a/gdb/testsuite/gdb.tui/winheight.exp b/gdb/testsuite/gdb.tui/winheight.exp index 8ac55f8472..bbfb7de376 100644 --- a/gdb/testsuite/gdb.tui/winheight.exp +++ b/gdb/testsuite/gdb.tui/winheight.exp @@ -26,6 +26,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { Term::clean_restart 24 80 $testfile if {![Term::enter_tui]} { unsupported "TUI not supported" + return } Term::check_box "source box" 0 0 80 15 -- 2.34.1