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: [committed][gdb/testsuite] Prevent proc override in gdb-index.exp
Date: Thu, 27 May 2021 15:26:57 +0200	[thread overview]
Message-ID: <20210527132656.GA3354@delia.home> (raw)

Hi,

When running these two test-cases in this specific order we get:
...
$ make check 'RUNTESTFLAGS=gdb.dwarf2/gdb-index.exp \
    gdb.dwarf2/gdb-add-index-symlink.exp'
  ...
Running gdb.dwarf2/gdb-index.exp ...
Running gdb.dwarf2/gdb-add-index-symlink.exp ...
FAIL: gdb.dwarf2/gdb-add-index-symlink.exp: gdb-index file created
FAIL: gdb.dwarf2/gdb-add-index-symlink.exp: Unable to call \
  gdb-add-index with a symlink to a symfile
...

The problem is that gdb-index.exp introduces a proc add_gdb_index which
overrides the one in lib/gdb.exp and stays active after the test is done.
Consequently it's used in gdb-add-index-symlink.exp, which should use the one
from lib/gdb.exp.

Fix this by renaming proc add_gdb_index in gdb-index.exp.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Prevent proc override in gdb-index.exp

gdb/testsuite/ChangeLog:

2021-05-27  Tom de Vries  <tdevries@suse.de>

	PR testsuite/27921
	* gdb.dwarf2/gdb-index.exp (add_gdb_index): Rename to ...
	(local_add_gdb_index): ... this.

---
 gdb/testsuite/gdb.dwarf2/gdb-index.exp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
index 3807c75294f..0b7adb5379d 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
@@ -31,8 +31,9 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
 # PROGRAM is assumed to be the output of standard_output_file.
 # Returns the path of the program or "" if there is a failure.
 # If there is a failure it will have already been logged.
+# Use local prefix to prevent overriding add_gdb_index from lib/gdb.exp.
 
-proc add_gdb_index { program } {
+proc local_add_gdb_index { program } {
     set index_file ${program}.gdb-index
     set dir [file dirname ${program}]
     set filename [file tail ${program}]
@@ -90,7 +91,7 @@ gdb_test_multiple "mt print objfiles ${testfile}" $test {
 	set binfile_with_index $binfile
     }
     -re "Psymtabs.*${gdb_prompt} $" {
-	set binfile_with_index [add_gdb_index $binfile]
+	set binfile_with_index [local_add_gdb_index $binfile]
 	if { ${binfile_with_index} == "" } {
 	    return -1
 	}

                 reply	other threads:[~2021-05-27 13:27 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=20210527132656.GA3354@delia.home \
    --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