[gdb/testsuite] Prevent proc override in gdb-index.exp
authorTom de Vries <tdevries@suse.de>
Thu, 27 May 2021 13:22:38 +0000 (15:22 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 27 May 2021 13:22:38 +0000 (15:22 +0200)
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.

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/ChangeLog
gdb/testsuite/gdb.dwarf2/gdb-index.exp

index df1ba09d502fe820e8cda715532a38ad3ed07f5d..968e623db408c88731d5f8f8262235dd9b799e58 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2021-05-21  Tom de Vries  <tdevries@suse.de>
 
        PR testsuite/25047
index 3807c75294f504a910bba821968073f614382e85..0b7adb5379de40c1b2920afbec0c7e2b54bba1ac 100644 (file)
@@ -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
        }
This page took 0.05119 seconds and 4 git commands to generate.