public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH v2 78/79] Rename to allow_tui_tests
Date: Wed, 11 Jan 2023 20:00:51 -0700	[thread overview]
Message-ID: <20230112030052.3306113-79-tom@tromey.com> (raw)
In-Reply-To: <20230112030052.3306113-1-tom@tromey.com>

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.
---
 gdb/testsuite/gdb.base/options.exp              |  2 +-
 .../gdb.python/tui-window-disabled.exp          |  4 +---
 gdb/testsuite/gdb.python/tui-window-names.exp   |  6 +-----
 gdb/testsuite/gdb.python/tui-window.exp         |  5 +----
 gdb/testsuite/gdb.tui/completion.exp            |  4 +++-
 gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp |  2 +-
 gdb/testsuite/gdb.tui/tui-layout.exp            |  6 ++----
 .../gdb.tui/tui-nl-filtered-output.exp          |  6 ++----
 gdb/testsuite/lib/completion-support.exp        |  2 +-
 gdb/testsuite/lib/gdb.exp                       | 17 ++++-------------
 gdb/testsuite/lib/tuiterm.exp                   |  2 +-
 gdb/top.c                                       | 10 ++++++++++
 12 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
index 2be7f878e7e..486192e3472 100644
--- a/gdb/testsuite/gdb.base/options.exp
+++ b/gdb/testsuite/gdb.base/options.exp
@@ -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.
diff --git a/gdb/testsuite/gdb.python/tui-window-disabled.exp b/gdb/testsuite/gdb.python/tui-window-disabled.exp
index 36ecb0b5ef1..57d41cdbf8b 100644
--- a/gdb/testsuite/gdb.python/tui-window-disabled.exp
+++ b/gdb/testsuite/gdb.python/tui-window-disabled.exp
@@ -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 \
diff --git a/gdb/testsuite/gdb.python/tui-window-names.exp b/gdb/testsuite/gdb.python/tui-window-names.exp
index 125a5f5a9b5..1a25be89299 100644
--- a/gdb/testsuite/gdb.python/tui-window-names.exp
+++ b/gdb/testsuite/gdb.python/tui-window-names.exp
@@ -18,16 +18,12 @@
 
 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.
diff --git a/gdb/testsuite/gdb.python/tui-window.exp b/gdb/testsuite/gdb.python/tui-window.exp
index 529ed16b641..af2a866e78b 100644
--- a/gdb/testsuite/gdb.python/tui-window.exp
+++ b/gdb/testsuite/gdb.python/tui-window.exp
@@ -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
 
diff --git a/gdb/testsuite/gdb.tui/completion.exp b/gdb/testsuite/gdb.tui/completion.exp
index 00956488c9f..a3b3114a472 100644
--- a/gdb/testsuite/gdb.tui/completion.exp
+++ b/gdb/testsuite/gdb.tui/completion.exp
@@ -13,10 +13,12 @@
 # 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
 }
 
diff --git a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
index 0ad91308ca4..7e3cff3950b 100644
--- a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
+++ b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
@@ -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
diff --git a/gdb/testsuite/gdb.tui/tui-layout.exp b/gdb/testsuite/gdb.tui/tui-layout.exp
index 97734cf7b68..2c502191d11 100644
--- a/gdb/testsuite/gdb.tui/tui-layout.exp
+++ b/gdb/testsuite/gdb.tui/tui-layout.exp
@@ -16,16 +16,14 @@
 # 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.
 
diff --git a/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp b/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
index 5a2a4205bb5..b7ea67cf723 100644
--- a/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
+++ b/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
@@ -30,13 +30,11 @@
 #
 #  (gdb)
 
+require allow_tui_tests
+
 gdb_exit
 gdb_start
 
-if {[skip_tui_tests]} {
-    return
-}
-
 # Enable the TUI.
 
 set test "tui enable"
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index f47f1d3ec50..bf9c5ad352c 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -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"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 31f11b22f87..5359315667e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -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
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 591c4ca9c4c..c38ccbbdbd7 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -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
 	}
 
diff --git a/gdb/top.c b/gdb/top.c
index c32ab896a0e..205eb360ba3 100644
--- 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\
-- 
2.39.0


  parent reply	other threads:[~2023-01-12  3:01 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12  2:59 [PATCH v2 00/79] Rewrite "require" test procedure and use it more often Tom Tromey
2023-01-12  2:59 ` [PATCH v2 01/79] Don't use ensure_gdb_index with require Tom Tromey
2023-01-12  2:59 ` [PATCH v2 02/79] Change 'require' to accept a list of predicates Tom Tromey
2023-01-12  2:59 ` [PATCH v2 03/79] Use unsupported in 'require' Tom Tromey
2023-01-12  2:59 ` [PATCH v2 04/79] Use require supports_reverse Tom Tromey
2023-01-12  2:59 ` [PATCH v2 05/79] Use require supports_process_record Tom Tromey
2023-01-12  2:59 ` [PATCH v2 06/79] Use require dwarf2_support Tom Tromey
2023-01-12  2:59 ` [PATCH v2 07/79] Use require is_x86_like_target Tom Tromey
2023-01-12  2:59 ` [PATCH v2 08/79] Use require skip_cplus_tests Tom Tromey
2023-01-12  3:56   ` Kevin Buettner
2023-01-12  2:59 ` [PATCH v2 09/79] Use require skip_shlib_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 10/79] Use require skip_dlmopen_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 11/79] Use require skip_stl_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 12/79] Use require skip_rust_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 13/79] Use require skip_fortran_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 14/79] Use require skip_ada_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 15/79] Use require skip_go_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 16/79] Use require skip_d_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 17/79] Use require skip_ctf_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 18/79] Use require skip_hw_watchpoint_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 19/79] Use require skip_ifunc_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 20/79] Use require skip_aarch64_sve_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 21/79] Use require skip_btrace_pt_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 22/79] Use require skip_btrace_tests Tom Tromey
2023-01-12  2:59 ` [PATCH v2 23/79] Use require skip_avx_* Tom Tromey
2023-01-12  2:59 ` [PATCH v2 24/79] Use require support_displaced_stepping Tom Tromey
2023-01-12  2:59 ` [PATCH v2 25/79] Use require is_aarch64_target Tom Tromey
2023-01-12  2:59 ` [PATCH v2 26/79] Use require is_aarch32_target Tom Tromey
2023-01-12  3:00 ` [PATCH v2 27/79] Use require is_amd64_regs_target Tom Tromey
2023-01-12  3:00 ` [PATCH v2 28/79] Use require is_elf_target Tom Tromey
2023-01-12  3:00 ` [PATCH v2 29/79] Use require can_single_step_to_signal_handler Tom Tromey
2023-01-12  3:00 ` [PATCH v2 30/79] Use require supports_get_siginfo_type Tom Tromey
2023-01-12  3:00 ` [PATCH v2 31/79] Use require support_go_compile Tom Tromey
2023-01-12  3:00 ` [PATCH v2 32/79] Use require use_gdb_stub Tom Tromey
2023-01-12  3:00 ` [PATCH v2 33/79] Use require can_spawn_for_attach Tom Tromey
2023-01-12  3:00 ` [PATCH v2 34/79] Use require isnative Tom Tromey
2023-01-12  3:00 ` [PATCH v2 35/79] Use require skip_gdbserver_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 36/79] Use require skip_shlib_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 37/79] Use require is_c_compiler_gcc Tom Tromey
2023-01-12  3:00 ` [PATCH v2 38/79] Use require gdb_debug_enabled Tom Tromey
2023-01-12  3:00 ` [PATCH v2 39/79] Use require gdb_skip_xml_test Tom Tromey
2023-01-12  3:00 ` [PATCH v2 40/79] Use require gdb_trace_common_supports_arch Tom Tromey
2023-01-12  3:00 ` [PATCH v2 41/79] Use require skip_perf_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 42/79] Use require skip_opencl_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 43/79] Use require target_can_use_run_cmd Tom Tromey
2023-01-12  3:00 ` [PATCH v2 44/79] Use require using_fission Tom Tromey
2023-01-12  3:00 ` [PATCH v2 45/79] Use require skip_debuginfod_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 46/79] Use require gnat_runtime_has_debug_info Tom Tromey
2023-01-12  3:00 ` [PATCH v2 47/79] Rewrite skip_python_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 48/79] Remove mi_skip_python_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 49/79] Fix latent bug in default_prompt_gdb_start Tom Tromey
2023-01-12  3:00 ` [PATCH v2 50/79] Use "require" for Python tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 51/79] Rename to allow_xml_test Tom Tromey
2023-01-12  3:00 ` [PATCH v2 52/79] Rename to allow_aarch64_sve_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 53/79] Rename to allow_ada_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 54/79] Rename to allow_avx512bf16_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 55/79] Rename to allow_avx512fp16_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 56/79] Rename to allow_btrace_pt_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 57/79] Rename to allow_btrace_tests Tom Tromey
2023-01-12  6:39   ` Metzger, Markus T
2023-01-12  3:00 ` [PATCH v2 58/79] Rename to allow_cplus_tests and allow_stl_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 59/79] Rename to allow_ctf_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 60/79] Rename to allow_debuginfod_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 61/79] Rename to allow_dlmopen_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 62/79] Rename to allow_d_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 63/79] Rename to allow_fortran_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 64/79] Rename to allow_gdbserver_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 65/79] Rename to allow_go_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 66/79] Rename to allow_hw_watchpoint_access_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 67/79] Rename to allow_hw_watchpoint_multi_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 68/79] Rename to allow_hw_watchpoint_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 69/79] Rename to allow_ifunc_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 70/79] Rename to allow_opencl_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 71/79] Rename to allow_perf_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 72/79] Rename to allow_python_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 73/79] Rename to allow_rust_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 74/79] Rename to allow_shlib_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 75/79] Rename to allow_tsx_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 76/79] Rename to allow_hw_breakpoint_tests Tom Tromey
2023-01-12  3:00 ` [PATCH v2 77/79] Rename to allow_guile_tests Tom Tromey
2023-01-14 16:22   ` Tom de Vries
2023-01-14 19:50     ` Tom Tromey
2023-01-12  3:00 ` Tom Tromey [this message]
2023-01-12  3:00 ` [PATCH v2 79/79] Consolidate calls to require Tom Tromey
2023-01-13 12:48   ` Pedro Alves
2023-01-13 14:07     ` Tom Tromey
2023-01-13 14:45       ` Pedro Alves
2023-01-13 19:13         ` Tom Tromey
2023-01-12  4:45 ` [PATCH v2 00/79] Rewrite "require" test procedure and use it more often Kevin Buettner
2023-01-13  3:51   ` Tom Tromey
2023-01-13 20:18 ` Tom Tromey

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=20230112030052.3306113-79-tom@tromey.com \
    --to=tom@tromey.com \
    --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).