Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 3/3] [gdb/testsuite] Add gdb.tui/internal-error.exp
Date: Fri, 16 Oct 2026 17:28:49 +0200	[thread overview]
Message-ID: <20261016152849.87694-4-tdevries@suse.de> (raw)
In-Reply-To: <20261016152849.87694-1-tdevries@suse.de>

Add test-case gdb.tui/internal-error.exp, a test-case for the
internal_vproblem part of commit a4f8f290270 ("gdb/tui: disable tui mode when
an assert triggers").
---
 gdb/testsuite/gdb.tui/internal-error.exp | 59 ++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 gdb/testsuite/gdb.tui/internal-error.exp

diff --git a/gdb/testsuite/gdb.tui/internal-error.exp b/gdb/testsuite/gdb.tui/internal-error.exp
new file mode 100644
index 00000000000..5d827f7adaa
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/internal-error.exp
@@ -0,0 +1,59 @@
+# Copyright 2026 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check handling of internal-error in TUI.
+
+tuiterm_env
+
+require allow_tui_tests
+
+foreach_with_prefix quit {yes no} {
+    Term::clean_restart 24 80
+
+    gdb_test_no_output "maint set internal-error corefile no"
+    gdb_test_no_output "maint set internal-error quit $quit"
+
+    require Term::enter_tui
+
+    send_gdb "maint internal-error\n"
+    set re_msg_line \
+	[string_to_regexp \
+	     "This is a bug, please report it."]
+    set re_msg \
+	[multi_line \
+	     "" \
+	     $re_msg_line]
+    gdb_assert \
+	{[Term::wait_for_region_contents 0 0 80 24 $re_msg]} \
+	"saw message"
+
+    if {$quit == "yes"} {
+	set seen_eof 0
+	gdb_expect {
+	    eof {
+		set seen_eof 1
+		gdb_exit_cleanup
+	    }
+	}
+
+	gdb_assert {$seen_eof} "exited"
+    } else {
+	gdb_assert {[Term::wait_for ""]} "got prompt"
+	gdb_assert {[Term::command "print 1"]} "responsive prompt"
+	send_gdb "info win\n"
+	set re_no_tui [string_to_regexp "The TUI is not active."]
+	gdb_assert {[Term::wait_for $re_no_tui]} "TUI disabled"
+    }
+}
-- 
2.51.0


      parent reply	other threads:[~2026-10-16 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 15:28 [pushed 0/3] [gdb/testsuite] Add some tui test-cases Tom de Vries
2026-10-16 15:28 ` [pushed 1/3] [gdb/testsuite] Handle non-existing testfile in find_core_file Tom de Vries
2026-10-16 15:28 ` [pushed 2/3] [gdb/testsuite] Add gdb.tui/fatal.exp Tom de Vries
2026-10-16 15:28 ` Tom de Vries [this message]

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=20261016152849.87694-4-tdevries@suse.de \
    --to=tdevries@suse.de \
    --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