public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Fix tcl error in jit-elf-helpers.exp
@ 2020-05-12 12:43 Tom de Vries
  2020-05-24 14:24 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-05-12 12:43 UTC (permalink / raw)
  To: gdb-patches

Hi,

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.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix tcl error in jit-elf-helpers.exp

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/lib/jit-elf-helpers.exp | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/lib/jit-elf-helpers.exp b/gdb/testsuite/lib/jit-elf-helpers.exp
index ab647abe50..62672f4ab3 100644
--- a/gdb/testsuite/lib/jit-elf-helpers.exp
+++ b/gdb/testsuite/lib/jit-elf-helpers.exp
@@ -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
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [committed][gdb/testsuite] Fix tcl error in jit-elf-helpers.exp
  2020-05-12 12:43 [committed][gdb/testsuite] Fix tcl error in jit-elf-helpers.exp Tom de Vries
@ 2020-05-24 14:24 ` Simon Marchi
  2020-05-25 10:29   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-05-24 14:24 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 2020-05-12 8:43 a.m., Tom de Vries wrote:
> @@ -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

I just noticed, should it be `$f` instead of `$binfile` here?

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [committed][gdb/testsuite] Fix tcl error in jit-elf-helpers.exp
  2020-05-24 14:24 ` Simon Marchi
@ 2020-05-25 10:29   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2020-05-25 10:29 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

On 24-05-2020 16:24, Simon Marchi wrote:
> On 2020-05-12 8:43 a.m., Tom de Vries wrote:
>> @@ -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
> 
> I just noticed, should it be `$f` instead of `$binfile` here?

Yes, thanks for noticing.

Fixed in attached patch, committed.

Thanks,
- Tom


[-- Attachment #2: 0001-gdb-testsuite-Fix-var-use-in-compile_and_download_n_jit_so.patch --]
[-- Type: text/x-patch, Size: 1317 bytes --]

[gdb/testsuite] Fix var use in compile_and_download_n_jit_so

In commit 1b59ca1cf1 "[gdb/testsuite] Fix tcl error in jit-elf-helpers.exp", I
introduced a variable f in compile_and_download_n_jit_so, to be used in the
untested message, but actually variable binfile was used instead:
...
+           set f [file tail $binfile]
+           untested "failed to compile shared library $binfile"
...

Fix this by using $f in the untested message.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/jit-elf-helpers.exp (compile_and_download_n_jit_so): Use $f
	instead of $binfile in the untested message.

---
 gdb/testsuite/lib/jit-elf-helpers.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/jit-elf-helpers.exp b/gdb/testsuite/lib/jit-elf-helpers.exp
index 62672f4ab3..f1e8ad7785 100644
--- a/gdb/testsuite/lib/jit-elf-helpers.exp
+++ b/gdb/testsuite/lib/jit-elf-helpers.exp
@@ -99,7 +99,7 @@ proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count}
 	if { [gdb_compile_shlib ${jit_solib_srcfile} ${binfile} \
 		  $options] != "" } {
 	    set f [file tail $binfile]
-	    untested "failed to compile shared library $binfile"
+	    untested "failed to compile shared library $f"
 	    return -1
 	}
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-25 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 12:43 [committed][gdb/testsuite] Fix tcl error in jit-elf-helpers.exp Tom de Vries
2020-05-24 14:24 ` Simon Marchi
2020-05-25 10:29   ` Tom de Vries

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).