diff mbox

[gdb/testsuite] Ignore pass/fail/unsupported in gdb-caching-proc.exp

Message ID e7865e7b-c252-0deb-2ea2-60b7256810d3@suse.de
State New
Headers show

Commit Message

Tom de Vries Feb. 17, 2020, 11:23 p.m. UTC
On 17-02-2020 21:51, Simon Marchi wrote:
> On 2020-02-13 10:02 a.m., Tom de Vries wrote:
>> On 13-02-2020 15:32, Tom Tromey wrote:
>>>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>>>
>>> Tom> 2020-02-13  Tom de Vries  <tdevries@suse.de>
>>>
>>> Tom> 	* gdb.base/gdb-caching-proc.exp (ignore_pass, ignore_fail)
>>> Tom> 	(ignore_unsupported): New proc.
>>> Tom> 	(test_proc): Temporarily rename pass/fail/ignore to
>>> Tom> 	ignore_{pass,fail,ignore} in order to ignore PASS/FAIL/IGNORE messages
>>> Tom> 	from the tested procs.
>>>
>>> Can we just require that caching proc bodies not invoke tests?
>>>
>>
>> We could, I don't have preference one way or the other.
>>
>> If I remove all the fail calls from gnat_runtime_has_debug_info, we
>> still get these PASSes from gdb_compile_ada:
>> ...
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: compilation gnat_debug_info_test.adb
>> PASS: gdb.base/gdb-caching-proc.exp: gnat_runtime_has_debug_info consistency
>> ...
>>
>> But we can factor that out, I've already done that once here (
>> https://sourceware.org/ml/gdb-patches/2019-10/msg01109.html ).
>>
>> Simon, WDYT?
>>
>> Thanks,
>> - Tom
>>
> 
> If you can indeed do that, I think it would be best.

Done.  Ok for trunk?

Thanks,
- Tom

Comments

Simon Marchi Feb. 17, 2020, 11:58 p.m. UTC | #1
On 2020-02-17 6:23 p.m., Tom de Vries wrote:
> diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
> index 9933cc951e..0689eeb239 100644
> --- a/gdb/testsuite/lib/ada.exp
> +++ b/gdb/testsuite/lib/ada.exp
> @@ -52,9 +52,9 @@ proc target_compile_ada_from_dir {builddir source dest type options} {
>      return -options $options $result
>  }
>  
> -# Compile some Ada code.
> +# Compile some Ada code.  Return "" if the compile was successful.
>  
> -proc gdb_compile_ada {source dest type options} {
> +proc gdb_compile_ada_1 {source dest type options} {
>  
>      set srcdir [file dirname $source]
>      set gprdir [file dirname $srcdir]
> @@ -80,6 +80,15 @@ proc gdb_compile_ada {source dest type options} {
>      # We therefore simply check whether the dest file has been created
>      # or not. Unless not present, the build has succeeded.
>      if [file exists $dest] { set result "" }
> +    return $result
> +}
> +
> +# Compile some Ada code.  Generate "PASS: foo.exp: compilation SOURCE" if the
> +# compile was successful.
> +
> +proc gdb_compile_ada {source dest type options} {
> +    set result [gdb_compile_ada_1 $source $dest $type $options]
> +
>      gdb_compile_test $source $result
>      return $result
>  }
> @@ -162,15 +171,13 @@ gdb_caching_proc gnat_runtime_has_debug_info {
>      set src "$srcdir/lib/gnat_debug_info_test.adb"
>      set dst [standard_output_file "gnat_debug_info_test"]
>  
> -    if { [gdb_compile_ada $src $dst executable {debug}] != "" } {
> -	fail "failed to compile gnat-debug-info test binary"
> +    if { [gdb_compile_ada_1 $src $dst executable {debug}] != "" } {
>  	return 0
>      }
>  
>      clean_restart $dst
>  
>      if { ! [runto "GNAT_Debug_Info_Test"] } {
> -	fail "failed to run to GNAT_Debug_Info_Test"
>  	return 0
>      }
>  
> @@ -183,7 +190,6 @@ gdb_caching_proc gnat_runtime_has_debug_info {
>  	}
>  	default {
>  	    # Some other unexpected output...
> -	    fail $gdb_test_name
>  	}
>      }
>  

I'd be tempted to keep these last two "fail"s.  They should not show up normally,
regardless of whether gnatmake is installed.  But let's say:

- the Ada runtime ever changes (__gnat_debug_raise_exception is renamed), or
- the output of the command "whatis __gnat_debug_raise_exception" changes

then they'll show up, which is desirable because it means we need to come
and change something here.  If the output of
"whatis __gnat_debug_raise_exception" changes in a way that it is not
recognized anymore and there is no FAIL, then gnat_runtime_has_debug_info
will just start returning false all the time and we might not notice it for a
while.

Simon
diff mbox

Patch

[gdb/testsuite] Don't pass/fail in gnat_runtime_has_debug_info

After de-installing gnatmake, I get:
...
Running src/gdb/testsuite/gdb.base/gdb-caching-proc.exp ...
FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary
  ...
FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary
...

In gdb.sum, we see these FAILs (each paired with an UNSUPPORTED as well)
followed by:
...
PASS: gdb-caching-proc.exp: gnat_runtime_has_debug_info consistency
...

Fix this by removing the fail calls in gnat_runtime_has_debug_info, as well
as using a new variant gdb_compile_ada_1 that doesn't call pass.

Tested on x86_64-linux, with gnatmake installed and de-installed.

gdb/testsuite/ChangeLog:

2020-02-18  Tom de Vries  <tdevries@suse.de>

	* lib/ada.exp (gdb_compile_ada_1): Factor out of ...
	(gdb_compile_ada): ... here.
	(gnat_runtime_has_debug_info): Remove fail calls.  Use
	gdb_compile_ada_1 instead of gdb_compile_ada.

---
 gdb/testsuite/lib/ada.exp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 9933cc951e..0689eeb239 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -52,9 +52,9 @@  proc target_compile_ada_from_dir {builddir source dest type options} {
     return -options $options $result
 }
 
-# Compile some Ada code.
+# Compile some Ada code.  Return "" if the compile was successful.
 
-proc gdb_compile_ada {source dest type options} {
+proc gdb_compile_ada_1 {source dest type options} {
 
     set srcdir [file dirname $source]
     set gprdir [file dirname $srcdir]
@@ -80,6 +80,15 @@  proc gdb_compile_ada {source dest type options} {
     # We therefore simply check whether the dest file has been created
     # or not. Unless not present, the build has succeeded.
     if [file exists $dest] { set result "" }
+    return $result
+}
+
+# Compile some Ada code.  Generate "PASS: foo.exp: compilation SOURCE" if the
+# compile was successful.
+
+proc gdb_compile_ada {source dest type options} {
+    set result [gdb_compile_ada_1 $source $dest $type $options]
+
     gdb_compile_test $source $result
     return $result
 }
@@ -162,15 +171,13 @@  gdb_caching_proc gnat_runtime_has_debug_info {
     set src "$srcdir/lib/gnat_debug_info_test.adb"
     set dst [standard_output_file "gnat_debug_info_test"]
 
-    if { [gdb_compile_ada $src $dst executable {debug}] != "" } {
-	fail "failed to compile gnat-debug-info test binary"
+    if { [gdb_compile_ada_1 $src $dst executable {debug}] != "" } {
 	return 0
     }
 
     clean_restart $dst
 
     if { ! [runto "GNAT_Debug_Info_Test"] } {
-	fail "failed to run to GNAT_Debug_Info_Test"
 	return 0
     }
 
@@ -183,7 +190,6 @@  gdb_caching_proc gnat_runtime_has_debug_info {
 	}
 	default {
 	    # Some other unexpected output...
-	    fail $gdb_test_name
 	}
     }