diff mbox series

[testsuite/guality] Be verbose about gdb version used

Message ID 20180622113456.r4pnsat4yz3qwac5@localhost.localdomain
State New
Headers show
Series [testsuite/guality] Be verbose about gdb version used | expand

Commit Message

Tom de Vries June 22, 2018, 11:35 a.m. UTC
Hi,

by default, guality invokes gdb with --quiet to avoid being unnecessarily
verbose for each test.  But as a consequence, we don't see which version of
gdb is used.

This patch adds printing of the full path to the gdb used, as well as the
gdb version as printed by gdb.

Tested on x86_64.

OK for trunk?

Thanks,
- Tom

[testsuite/guality] Be verbose about gdb version used

2018-06-22  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (report_gdb): New proc.
	* g++.dg/guality/guality.exp: Use report_gdb.
	* gcc.dg/guality/guality.exp: Same.
	* gfortran.dg/guality/guality.exp: Same.

---
 gcc/testsuite/g++.dg/guality/guality.exp      |  1 +
 gcc/testsuite/gcc.dg/guality/guality.exp      |  1 +
 gcc/testsuite/gfortran.dg/guality/guality.exp |  1 +
 gcc/testsuite/lib/gcc-gdb-test.exp            | 10 ++++++++++
 4 files changed, 13 insertions(+)

Comments

Jeff Law June 22, 2018, 4 p.m. UTC | #1
On 06/22/2018 05:35 AM, Tom de Vries wrote:
> Hi,
> 
> by default, guality invokes gdb with --quiet to avoid being unnecessarily
> verbose for each test.  But as a consequence, we don't see which version of
> gdb is used.
> 
> This patch adds printing of the full path to the gdb used, as well as the
> gdb version as printed by gdb.
> 
> Tested on x86_64.
> 
> OK for trunk?
> 
> Thanks,
> - Tom
> 
> [testsuite/guality] Be verbose about gdb version used
> 
> 2018-06-22  Tom de Vries  <tdevries@suse.de>
> 
> 	* lib/gcc-gdb-test.exp (report_gdb): New proc.
> 	* g++.dg/guality/guality.exp: Use report_gdb.
> 	* gcc.dg/guality/guality.exp: Same.
> 	* gfortran.dg/guality/guality.exp: Same.
OK.
jeff
Christophe Lyon June 23, 2018, 5:05 p.m. UTC | #2
Hello,

On Fri, 22 Jun 2018 at 18:01, Jeff Law <law@redhat.com> wrote:
>
> On 06/22/2018 05:35 AM, Tom de Vries wrote:
> > Hi,
> >
> > by default, guality invokes gdb with --quiet to avoid being unnecessarily
> > verbose for each test.  But as a consequence, we don't see which version of
> > gdb is used.
> >
> > This patch adds printing of the full path to the gdb used, as well as the
> > gdb version as printed by gdb.
> >
> > Tested on x86_64.
> >
> > OK for trunk?
> >
> > Thanks,
> > - Tom
> >
> > [testsuite/guality] Be verbose about gdb version used
> >
> > 2018-06-22  Tom de Vries  <tdevries@suse.de>
> >
> >       * lib/gcc-gdb-test.exp (report_gdb): New proc.
> >       * g++.dg/guality/guality.exp: Use report_gdb.
> >       * gcc.dg/guality/guality.exp: Same.
> >       * gfortran.dg/guality/guality.exp: Same.
> OK.

It looks like this patch is causing problems when not building gdb. I
my GCC testing, I'm now seeing:
ERROR: tcl error sourcing /gcc/testsuite/gfortran.dg/guality/guality.exp.
ERROR: which: no aarch64-none-linux-gnu-gdb in
(/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/bin:/work/local/bin:/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/utils/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin)
    while executing
"exec which $::env(GUALITY_GDB_NAME)"
    invoked from within
"report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]"


> jeff
Tom de Vries June 23, 2018, 11:47 p.m. UTC | #3
On 06/23/2018 07:05 PM, Christophe Lyon wrote:
> Hello,
> 
> On Fri, 22 Jun 2018 at 18:01, Jeff Law <law@redhat.com> wrote:
>>
>> On 06/22/2018 05:35 AM, Tom de Vries wrote:
>>> Hi,
>>>
>>> by default, guality invokes gdb with --quiet to avoid being unnecessarily
>>> verbose for each test.  But as a consequence, we don't see which version of
>>> gdb is used.
>>>
>>> This patch adds printing of the full path to the gdb used, as well as the
>>> gdb version as printed by gdb.
>>>
>>> Tested on x86_64.
>>>
>>> OK for trunk?
>>>
>>> Thanks,
>>> - Tom
>>>
>>> [testsuite/guality] Be verbose about gdb version used
>>>
>>> 2018-06-22  Tom de Vries  <tdevries@suse.de>
>>>
>>>       * lib/gcc-gdb-test.exp (report_gdb): New proc.
>>>       * g++.dg/guality/guality.exp: Use report_gdb.
>>>       * gcc.dg/guality/guality.exp: Same.
>>>       * gfortran.dg/guality/guality.exp: Same.
>> OK.
> 
> It looks like this patch is causing problems when not building gdb. I
> my GCC testing, I'm now seeing:
> ERROR: tcl error sourcing /gcc/testsuite/gfortran.dg/guality/guality.exp.
> ERROR: which: no aarch64-none-linux-gnu-gdb in
> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/bin:/work/local/bin:/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/utils/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin)
>     while executing
> "exec which $::env(GUALITY_GDB_NAME)"
>     invoked from within
> "report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]"
> 

Hi,

the problem is not related to building or not building gdb, it's related
to whether the gdb that guality.exp is trying to use, is available in
PATH or not.

I've fixed this in attached patch.

Thanks,
- Tom
[testsuite/guality] Fix tcl error on missing gdb

2018-06-24  Tom de Vries  <tdevries@suse.de>

	* g++.dg/guality/guality.exp: Don't use which on gdb arg to report_gdb.
	* gcc.dg/guality/guality.exp: Same.
	* gfortran.dg/guality/guality.exp: Same.
	* lib/gcc-gdb-test.exp: Do early out if which gdb fails.

---
 gcc/testsuite/g++.dg/guality/guality.exp      | 2 +-
 gcc/testsuite/gcc.dg/guality/guality.exp      | 2 +-
 gcc/testsuite/gfortran.dg/guality/guality.exp | 2 +-
 gcc/testsuite/lib/gcc-gdb-test.exp            | 5 +++++
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index e5eaceedc9a..4be22baa19c 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -46,7 +46,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
-report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
+report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index 2a90ec3c8c8..04e889caa2f 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -46,7 +46,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
-report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
+report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index 3784cac1ef3..f76347dd52f 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -27,7 +27,7 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
-report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
+report_gdb $::env(GUALITY_GDB_NAME) [info script]
 
 gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
 
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index f3726635c03..9aff6218300 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -145,6 +145,11 @@ proc gdb-test { args } {
 # Argument 1 is the location where gdb is used
 # 
 proc report_gdb { gdb loc } {
+    if { [catch { exec which $gdb } msg] } {
+	send_log "gdb not found in $loc: $msg\n"
+	return
+    }
+    set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
     set gdb_version [exec $gdb -v]
     send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
Andreas Schwab June 25, 2018, 12:32 p.m. UTC | #4
I'm still getting this error:

Running /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp ...
gdb used in /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp: /usr/bin/gdb
ERROR: tcl error sourcing /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp.
ERROR: GNU gdb (GDB; SUSE Linux Enterprise 11) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "ia64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
[GDB failed to load libunwind-ia64.so.8: libunwind-ia64.so.8: cannot open shared object file: No such file or directory]
[GDB failed to load libunwind-ia64.so.7: /usr/lib/libunwind-ia64.so.7: undefined symbol: _Uelf64_get_proc_name]
    while executing
"exec $gdb -v"
    (procedure "report_gdb" line 8)
    invoked from within
"report_gdb $::env(GUALITY_GDB_NAME) [info script]"
    (file "/usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp" line 49)
    invoked from within
"source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
testcase /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp completed in 0 seconds

Andreas.
Tom de Vries June 25, 2018, 1:18 p.m. UTC | #5
On 06/25/2018 02:32 PM, Andreas Schwab wrote:
> I'm still getting this error:
> 
> Running /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp ...
> gdb used in /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp: /usr/bin/gdb
> ERROR: tcl error sourcing /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp.
> ERROR: GNU gdb (GDB; SUSE Linux Enterprise 11) 7.9.1
> Copyright (C) 2015 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "ia64-suse-linux".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://bugs.opensuse.org/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word".
> [GDB failed to load libunwind-ia64.so.8: libunwind-ia64.so.8: cannot open shared object file: No such file or directory]
> [GDB failed to load libunwind-ia64.so.7: /usr/lib/libunwind-ia64.so.7: undefined symbol: _Uelf64_get_proc_name]
>     while executing
> "exec $gdb -v"
>     (procedure "report_gdb" line 8)
>     invoked from within
> "report_gdb $::env(GUALITY_GDB_NAME) [info script]"
>     (file "/usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp" line 49)
>     invoked from within
> "source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name""
> testcase /usr/local/gcc/gcc-20180625/gcc/testsuite/gcc.dg/guality/guality.exp completed in 0 seconds

Hi,

Can you try this patch to see if it fixes the error?

Thanks,
- Tom

diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp
b/gcc/testsuite/lib/gcc-gdb-test.exp
index 9aff6218300..a83c4ca04c7 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -151,6 +151,9 @@ proc report_gdb { gdb loc } {
     }
     set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
-    set gdb_version [exec $gdb -v]
+    if { [catch { set gdb_version [exec $gdb -v] }] } {
+       send_log "gdb used in $loc: getting version failed\n"
+       return
+    }
     send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
 }
Andreas Schwab June 25, 2018, 2:36 p.m. UTC | #6
On Jun 25 2018, Tom de Vries <tdevries@suse.de> wrote:

> @@ -151,6 +151,9 @@ proc report_gdb { gdb loc } {
>      }
>      set gdb [exec which $gdb]
>      send_log "gdb used in $loc: $gdb\n"
> -    set gdb_version [exec $gdb -v]
> +    if { [catch { set gdb_version [exec $gdb -v] }] } {
> +       send_log "gdb used in $loc: getting version failed\n"
> +       return
> +    }
>      send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
>  }

How about this instead:

diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index 9aff6218300..26fb7cd2f4d 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -151,6 +151,6 @@ proc report_gdb { gdb loc } {
     }
     set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
-    set gdb_version [exec $gdb -v]
+    catch { exec $gdb -v } gdb_version
     send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
 }

Andreas.
Tom de Vries June 25, 2018, 4:02 p.m. UTC | #7
On 06/25/2018 04:36 PM, Andreas Schwab wrote:
> On Jun 25 2018, Tom de Vries <tdevries@suse.de> wrote:
> 
>> @@ -151,6 +151,9 @@ proc report_gdb { gdb loc } {
>>      }
>>      set gdb [exec which $gdb]
>>      send_log "gdb used in $loc: $gdb\n"
>> -    set gdb_version [exec $gdb -v]
>> +    if { [catch { set gdb_version [exec $gdb -v] }] } {
>> +       send_log "gdb used in $loc: getting version failed\n"
>> +       return
>> +    }
>>      send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
>>  }
> 
> How about this instead:
> 
> diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
> index 9aff6218300..26fb7cd2f4d 100644
> --- a/gcc/testsuite/lib/gcc-gdb-test.exp
> +++ b/gcc/testsuite/lib/gcc-gdb-test.exp
> @@ -151,6 +151,6 @@ proc report_gdb { gdb loc } {
>      }
>      set gdb [exec which $gdb]
>      send_log "gdb used in $loc: $gdb\n"
> -    set gdb_version [exec $gdb -v]
> +    catch { exec $gdb -v } gdb_version
>      send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
>  }

Hmm, eliminating the set in the catch body is a good idea. But I want to
start with a note that running gdb -v failed.

Committed as attached.

Thanks,
- Tom
[testsuite/guality] Fix tcl error on gdb -v failure

2018-06-25  Tom de Vries  <tdevries@suse.de>

	* lib/gcc-gdb-test.exp (report_gdb): Handle gdb -v failure.

---
 gcc/testsuite/lib/gcc-gdb-test.exp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index 9aff6218300..2ef9ca15c12 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -151,6 +151,12 @@ proc report_gdb { gdb loc } {
     }
     set gdb [exec which $gdb]
     send_log "gdb used in $loc: $gdb\n"
-    set gdb_version [exec $gdb -v]
-    send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
+
+    send_log "gdb used in $loc: "
+    if { [catch { exec $gdb -v } gdb_version] } {
+	send_log "getting version failed:\n"
+    } else {
+	send_log "version:\n"
+    }
+    send_log -- "---\n$gdb_version\n---\n"
 }
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index 5bffd9df1a0..72f23c8cca7 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -43,6 +43,7 @@  if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index d2b863397ba..7eebd27b544 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -43,6 +43,7 @@  if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
 
 if {[check_guality "
   #include \"$srcdir/$subdir/guality.h\"
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index 3f96a04bd26..62875fd54b8 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -24,6 +24,7 @@  if ![info exists ::env(GUALITY_GDB_NAME)] {
     }
     setenv GUALITY_GDB_NAME "$guality_gdb_name"
 }
+report_gdb [exec which $::env(GUALITY_GDB_NAME)] [info script]
 
 gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" ""
 
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index 0c4d2a533f6..f3726635c03 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -139,3 +139,13 @@  proc gdb-test { args } {
     file delete $cmd_file
     return
 }
+
+# Report the gdb path and version log the .log file
+# Argument 0 is the gdb path
+# Argument 1 is the location where gdb is used
+# 
+proc report_gdb { gdb loc } {
+    send_log "gdb used in $loc: $gdb\n"
+    set gdb_version [exec $gdb -v]
+    send_log "gdb used in $loc: version:\n---\n$gdb_version\n---\n"
+}