public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.dwarf2/gdb-index-nodebug.exp with cc-with-gdb-index
Date: Mon, 2 Aug 2021 15:32:53 +0200	[thread overview]
Message-ID: <20210802133251.GA8580@delia> (raw)

Hi,

When running with target board cc-with-gdb-index, we run into:
...
(gdb) save gdb-index .^M
Error while writing index for `gdb-index-nodebug': \
  Cannot use an index to create the index^M
(gdb) FAIL: gdb.dwarf2/gdb-index-nodebug.exp: try to save gdb index
...

Fix this by detecting an already present index, and marking the test
unsupported.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.dwarf2/gdb-index-nodebug.exp with cc-with-gdb-index

gdb/testsuite/ChangeLog:

2021-08-02  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/gdb-index-nodebug.exp: Mark unsupported when index
	already present.

---
 gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
index 27b46d4cea5..6eb34f9f2c4 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
@@ -22,7 +22,26 @@ if {[prepare_for_testing "failed to prepare" "${testfile}" \
     return -1
 }
 
+set have_index [have_index $binfile]
+set have_index_re \
+    [list \
+	 "Error while writing index for \[^\r\n\]*:" \
+	 "Cannot use an index to create the index"]
+set have_index_re [join $have_index_re]
+set readnow_p [readnow]
+
 set index_file ${testfile}.gdb-index
 # The bug was that gdb would crash here.
-gdb_test_no_output "save gdb-index [file dirname ${index_file}]" \
-    "try to save gdb index"
+set cmd "save gdb-index [file dirname ${index_file}]"
+gdb_test_multiple $cmd "try to save gdb index" {
+    -re -wrap $have_index_re {
+	if { $have_index != "" || $readnow_p } {
+	    unsupported $gdb_test_name
+	} else {
+	    fail $gdb_test_name
+	}
+    }
+    -re -wrap "^$cmd" {
+	pass $gdb_test_name
+    }
+}

                 reply	other threads:[~2021-08-02 13:32 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=20210802133251.GA8580@delia \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).