Rename to allow_tui_tests
authorTom Tromey <tom@tromey.com>
Sun, 8 Jan 2023 19:42:29 +0000 (12:42 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 13 Jan 2023 20:18:58 +0000 (13:18 -0700)
This changes skip_tui_tests to invert the sense, and renames it to
allow_tui_tests.  It also rewrites this function to use the output of
"gdb --configuration", and it adds a note about the state of the TUI
to that output.

12 files changed:
gdb/testsuite/gdb.base/options.exp
gdb/testsuite/gdb.python/tui-window-disabled.exp
gdb/testsuite/gdb.python/tui-window-names.exp
gdb/testsuite/gdb.python/tui-window.exp
gdb/testsuite/gdb.tui/completion.exp
gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
gdb/testsuite/gdb.tui/tui-layout.exp
gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
gdb/testsuite/lib/completion-support.exp
gdb/testsuite/lib/gdb.exp
gdb/testsuite/lib/tuiterm.exp
gdb/top.c

index 2be7f878e7ecec7c100f4256b092526538100936..486192e3472288e1d51a615c9a43ef44f31fabbf 100644 (file)
@@ -47,7 +47,7 @@ if { ![readline_is_used] } {
     return -1
 }
 
-set tui_supported_p [expr ![skip_tui_tests]]
+set tui_supported_p [allow_tui_tests]
 
 # Check the completion result, as returned by the "maintenance show
 # test-options-completion-result" command.  TEST is used as test name.
index 36ecb0b5ef1c3f203a85beacbcec8b47e32f1eb3..57d41cdbf8b4ea8c62d99e7500fe671d51a69549 100644 (file)
@@ -22,6 +22,7 @@
 # though the tui should be disabled.
 
 load_lib gdb-python.exp
+require allow_tui_tests
 tuiterm_env
 
 standard_testfile
@@ -31,9 +32,6 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
 }
 
 clean_restart
-if {[skip_tui_tests]} {
-    return
-}
 
 # Copy the Python script to where the tests are being run.
 set remote_python_file [gdb_remote_download host \
index 125a5f5a9b5ee0d0c821838c82491b975ef79ee1..1a25be89299000e135ea513b29b915904ef55127 100644 (file)
 
 load_lib gdb-python.exp
 
-require allow_python_tests
+require allow_python_tests allow_tui_tests
 
 tuiterm_env
 
 clean_restart
 
-if {[skip_tui_tests]} {
-    return
-}
-
 # Define a function we can use as a window constructor.  If this ever
 # gets called we'll throw an error, but that's OK, this test doesn't
 # actually try to create any windows.
index 529ed16b6411eacbd957fcabc6e4da3c31cf6dd7..af2a866e78ba857f69e07abd8f67397243e86963 100644 (file)
@@ -16,7 +16,7 @@
 # Test a TUI window implemented in Python.
 
 load_lib gdb-python.exp
-require allow_python_tests
+require allow_python_tests allow_tui_tests
 tuiterm_env
 
 # This test doesn't care about the inferior.
@@ -27,9 +27,6 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
 }
 
 clean_restart
-if {[skip_tui_tests]} {
-    return
-}
 
 Term::clean_restart 24 80 $testfile
 
index 00956488c9f783167db70a5a2cd71f4b708c2786..a3b3114a472eb983bc33d700772b507481f5372f 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+require allow_tui_tests
+
 gdb_exit
 gdb_start
 
-if {[skip_tui_tests] || [target_info exists gdb,nointerrupts]} {
+if {[target_info exists gdb,nointerrupts]} {
     return
 }
 
index 0ad91308ca4718af76afd011bf52edca49b986df..7e3cff3950b86e634f12436239f58126690335bc 100644 (file)
@@ -33,7 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" \
 
 clean_restart "$binfile"
 
-if {[skip_tui_tests]} {
+if {![allow_tui_tests]} {
     # TUI support is disabled.  Check for error message.
     gdb_test "layout asm" "Undefined command: \"layout\".  Try \"help\"."
     return
index 97734cf7b680db438c53f8de3d2e0777ad1b5f33..2c502191d11ec2fab18198255bdabe54b59b899d 100644 (file)
 # Minimal testcase that just checks that the various "layout $foo"
 # commands do not cause gdb to crash.
 
+require allow_tui_tests
+
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
     return -1
 }
 
-if {[skip_tui_tests]} {
-    return
-}
-
 # Test one layout command.  EXECUTION indicates whether to activate
 # the layout with or without execution.
 
index 5a2a4205bb5a83fb19078aff6199d790760dc943..b7ea67cf7230d8a9529ecc98fa8d678eca85d196 100644 (file)
 #
 #  (gdb)
 
+require allow_tui_tests
+
 gdb_exit
 gdb_start
 
-if {[skip_tui_tests]} {
-    return
-}
-
 # Enable the TUI.
 
 set test "tui enable"
index f47f1d3ec507d3c97ffc258ef8fae68f56c1cb2b..bf9c5ad352c7594d2e8acac97fa4cf00274575a3 100644 (file)
@@ -555,7 +555,7 @@ proc test_gdb_completion_offers_commands {input_line} {
 
     # TUI adds additional commands to the possible completions, so we
     # need different patterns depending on whether or not it is enabled.
-    if { [skip_tui_tests] } {
+    if { ![allow_tui_tests] } {
        test_gdb_complete_multiple $input_line "" "" {
            "!"
            "actions"
index 31f11b22f8753d562500b32e920cb0f12d323721..5359315667e6d6ac24e40623ec6b103d6deabd71 100644 (file)
@@ -2572,20 +2572,11 @@ gdb_caching_proc allow_dlmopen_tests {
     return $allow_dlmopen_tests
 }
 
-# Return 1 if we should skip tui related tests.
+# Return 1 if we should allow TUI-related tests.
 
-proc skip_tui_tests {} {
-    global gdb_prompt
-
-    gdb_test_multiple "help layout" "verify tui support" {
-       -re "Undefined command: \"layout\".*$gdb_prompt $" {
-           return 1
-       }
-       -re "$gdb_prompt $" {
-       }
-    }
-
-    return 0
+gdb_caching_proc allow_tui_tests {
+    set output [remote_exec host $::GDB --configuration]
+    return [expr {[string first "--enable-tui" $output] != -1}]
 }
 
 # Test files shall make sure all the test result lines in gdb.sum are
index 591c4ca9c4c69b56bb3c6042d1373396fa608fec..c38ccbbdbd7f850db47fec1435a33dc82070f82f 100644 (file)
@@ -778,7 +778,7 @@ namespace eval Term {
     # Setup ready for starting the tui, but don't actually start it.
     # Returns 1 on success, 0 if TUI tests should be skipped.
     proc prepare_for_tui {} {
-       if {[skip_tui_tests]} {
+       if {![allow_tui_tests]} {
            return 0
        }
 
index c32ab896a0ec05a0a6261601e429320f71cca5c7..205eb360ba36df3215f422986dcd916fe64fb921 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1649,6 +1649,16 @@ This GDB was configured as follows:\n\
 "));
 #endif
 
+#ifdef TUI
+  gdb_printf (stream, _("\
+            --enable-tui\n\
+"));
+#else
+  gdb_printf (stream, _("\
+            --disable-tui\n\
+"));
+#endif
+
 #ifdef RELOC_SRCDIR
   gdb_printf (stream, _("\
             --with-relocated-sources=%s\n\