public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/testsuite] Handle USE_TUI in gdb.tui/corefile-run.exp
Date: Mon, 13 Mar 2023 16:20:19 +0000 (GMT)	[thread overview]
Message-ID: <20230313162020.0170A3858C66@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6b81ded4876cb836e5fd7d8bc2459fef99dcac70

commit 6b81ded4876cb836e5fd7d8bc2459fef99dcac70
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Mar 13 17:20:09 2023 +0100

    [gdb/testsuite] Handle USE_TUI in gdb.tui/corefile-run.exp
    
    Once in a while I find myself rewriting a TUI test-case into a non-TUI
    test-case, to better understand whether the problem I'm looking at is
    related to the TUI or not.
    
    I've got the impression that I've done this sufficiently often that it's worth
    committing the non-TUI version, so having just written a non-TUI version of
    gdb.tui/corefile-run.exp, let's commit it.
    
    The non-TUI version can be enabled by doing:
    ...
    $ make check "RUNTESTFLAGS=gdb.tui/corefile-run.exp USE_TUI=0"
    ...
    
    Also remove hard-coding of a source line number.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.tui/corefile-run.exp | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp
index 2109a0ae3eb..6769dfbd800 100644
--- a/gdb/testsuite/gdb.tui/corefile-run.exp
+++ b/gdb/testsuite/gdb.tui/corefile-run.exp
@@ -40,6 +40,19 @@ if { ![gdb_gcore_cmd "$core" "save a corefile"] } {
     return -1
 }
 
+set src_line "return 0;"
+set src_line_nr [gdb_get_line_number $src_line]
+
+set run_re \
+    "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\]"
+
+if { [info exists USE_TUI] && $USE_TUI == 0 } {
+    clean_restart $testfile
+    gdb_test "core-file $core" $src_line "load corefile"
+    gdb_test "run" $run_re "run until the end"
+    return
+}
+
 Term::clean_restart 24 80 $testfile
 if {![Term::enter_tui]} {
     unsupported "TUI not supported"
@@ -51,8 +64,7 @@ gdb_assert {![string match "No Source Available" $text]} \
     "initial source listing"
 
 Term::command "core-file $core"
-Term::check_contents "load corefile" "21 *return 0.*$gdb_prompt .*"
+Term::check_contents "load corefile" "$src_line_nr *$src_line.*$gdb_prompt .*"
 
 Term::command "run"
-Term::check_contents "run until the end" \
-    "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\]"
+Term::check_contents "run until the end" $run_re

                 reply	other threads:[~2023-03-13 16:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230313162020.0170A3858C66@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@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).