[gdb/testsuite] Fix tcl error in jit-elf-helpers.exp
authorTom de Vries <tdevries@suse.de>
Tue, 12 May 2020 12:41:47 +0000 (14:41 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 12 May 2020 12:41:47 +0000 (14:41 +0200)
When running test-case jit-elf.exp with target board cc-with-gdb-index, I run
into:
...
gdb compile failed, outputs/gdb.base/jit-elf/.tmp/jit-elf-main-attach: \
  No such file or directory.
ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/jit-elf.exp.
ERROR: can't read "main_basename": no such variable
    while executing
"untested "failed to compile ${main_basename}.c""
    (procedure "compile_jit_main" line 7)
...

The problem is in compile_jit_main in lib/jit-elf-helpers.exp, where we try to
emit an untested message using global variable main_basename.c.

Fixing this by declaring the variable global results in duplicate test-names,
because the same source file is compiled more than once.

Instead, fix this by using the result name in the untested message.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-05-12  Tom de Vries  <tdevries@suse.de>

* lib/jit-elf-helpers.exp: Don't use undefined variables in untested
messages.

gdb/testsuite/ChangeLog
gdb/testsuite/lib/jit-elf-helpers.exp

index 73df28faf178b339f2369286a4998a062b2002d4..8e7af0bb47e7e58a9995fc46a0d0760d523f11a9 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-12  Tom de Vries  <tdevries@suse.de>
+
+       * lib/jit-elf-helpers.exp: Don't use undefined variables in untested
+       messages.
+
 2020-05-12  Tom de Vries  <tdevries@suse.de>
 
        * gdb.multi/multi-term-settings.exp: Use with_test_prefix.
index ab647abe50eacf9c685fd04ddcbc17bdba6f3115..62672f4ab3b44116886f39754e0cc1ab8ac42ad1 100644 (file)
@@ -37,9 +37,10 @@ proc compile_jit_main {main_srcfile main_binfile options} {
        debug]
 
     if { [gdb_compile ${main_srcfile} ${main_binfile} \
-         executable $options] != "" } {
-             untested "failed to compile ${main_basename}.c"
-             return -1
+             executable $options] != "" } {
+       set f [file tail $main_binfile]
+       untested "failed to compile $f"
+       return -1
     }
 
     return 0
@@ -61,8 +62,9 @@ proc compile_jit_elf_main_as_so {main_solib_srcfile main_solib_binfile options}
        debug]
 
     if { [gdb_compile_shlib ${main_solib_srcfile} ${main_solib_binfile} \
-           $options] != "" } {
-       untested "failed to compile ${main_solib_basename}.c as a shared library"
+             $options] != "" } {
+       set f [file tail $main_solib_binfile]
+       untested "failed to compile shared library $f"
        return -1
     }
 
@@ -94,8 +96,10 @@ proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count}
            additional_flags=-DFUNCTION_NAME=[format "jit_function_%04d" $i] \
            additional_flags=-Xlinker \
            additional_flags=-Ttext-segment=$addr]
-       if { [gdb_compile_shlib ${jit_solib_srcfile} ${binfile} $options] != "" } {
-           untested "failed to compile ${jit_solib_basename}.c as a shared library"
+       if { [gdb_compile_shlib ${jit_solib_srcfile} ${binfile} \
+                 $options] != "" } {
+           set f [file tail $binfile]
+           untested "failed to compile shared library $binfile"
            return -1
        }
 
@@ -104,4 +108,4 @@ proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count}
     }
 
     return $binfiles_target
-}
\ No newline at end of file
+}
This page took 0.032091 seconds and 4 git commands to generate.