Share the "multi_line" helper among all Ada testcases

Message ID 55AD0A6E.6060604@adacore.com
State New, archived
Headers

Commit Message

Pierre-Marie de Rodat July 20, 2015, 2:49 p.m. UTC
  Sergio,

On 07/18/2015 02:35 AM, Sergio Durigan Junior wrote:
> Hmm, I am seeing a regression on gdb.ada/info_exc.exp because of this
> patch.  Because of the way multi_line was rewritten it is not possibe
> anymore to mean "anything" again; it will always be at least a newline
> (\r\n).
>
> I've rewritten the test to expect the exact output from "info
> exceptions" (i.e., removing the ".*" parts), but I am not sure this is
> the right thing to do.  Joel/Pierre?

Thank you for the heads-up! I did not notice this when submitting the 
patch... Anyway, I had a look at what commit introduced the ".*" parts:

commit 391d3400084c6a2d805cd0efd925f29347fa7a18
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Nov 15 20:34:09 2013 +0400

     gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with full 
debug info.

     If the runtime has full debug info, then the non-standard exceptions
     declared in the GNAT runtime will appear in the list of exceptions
     printed by GDB ("info exceptions" or "-info-ada-exceptions").
     This is valid output, so this patch allows for it.

So it looks like they are needed for some configuration. Then, what 
about this:

\"task\":" \
  

Comments

Sergio Durigan Junior July 20, 2015, 3:35 p.m. UTC | #1
Hey Pierre,

On Monday, July 20 2015, Pierre-Marie de Rodat wrote:

> On 07/18/2015 02:35 AM, Sergio Durigan Junior wrote:
>> Hmm, I am seeing a regression on gdb.ada/info_exc.exp because of this
>> patch.  Because of the way multi_line was rewritten it is not possibe
>> anymore to mean "anything" again; it will always be at least a newline
>> (\r\n).
>>
>> I've rewritten the test to expect the exact output from "info
>> exceptions" (i.e., removing the ".*" parts), but I am not sure this is
>> the right thing to do.  Joel/Pierre?
>
> Thank you for the heads-up! I did not notice this when submitting the
> patch... Anyway, I had a look at what commit introduced the ".*"
> parts:
>
> commit 391d3400084c6a2d805cd0efd925f29347fa7a18
> Author: Joel Brobecker <brobecker@adacore.com>
> Date:   Fri Nov 15 20:34:09 2013 +0400
>
>     gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with full
> debug info.
>
>     If the runtime has full debug info, then the non-standard exceptions
>     declared in the GNAT runtime will appear in the list of exceptions
>     printed by GDB ("info exceptions" or "-info-ada-exceptions").
>     This is valid output, so this patch allows for it.
>
> So it looks like they are needed for some configuration. Then, what
> about this:

Hm, right, thanks for checking this.  I suspected that the ".*" had a
reason to exist...

> diff --git a/gdb/testsuite/gdb.ada/info_exc.exp
> b/gdb/testsuite/gdb.ada/info_exc.exp
> index add83c5..448882b 100644
> --- a/gdb/testsuite/gdb.ada/info_exc.exp
> +++ b/gdb/testsuite/gdb.ada/info_exc.exp
> @@ -34,9 +34,7 @@ gdb_test "info exceptions" \
>                  "program_error: $hex" \
>                  "storage_error: $hex" \
>                  "tasking_error: $hex" \
> -                ".*" \
> -                "const.aint_global_gdb_e: $hex" \
> -                ".*"]
> +                "\(.*\r\n\)*const.aint_global_gdb_e: $hex\(.*\r\n\)*"]
>
>  gdb_test "info exceptions task" \
>      [multi_line "All Ada exceptions matching regular expression
> \"task\":" \

The patch looks good to me and works fine here (though I haven't tested
the case when the output contains more lines than expected).  I'm not a
maintainer of this area, so I cannot really approve this.

Thanks!
  

Patch

diff --git a/gdb/testsuite/gdb.ada/info_exc.exp 
b/gdb/testsuite/gdb.ada/info_exc.exp
index add83c5..448882b 100644
--- a/gdb/testsuite/gdb.ada/info_exc.exp
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -34,9 +34,7 @@  gdb_test "info exceptions" \
                  "program_error: $hex" \
                  "storage_error: $hex" \
                  "tasking_error: $hex" \
-                ".*" \
-                "const.aint_global_gdb_e: $hex" \
-                ".*"]
+                "\(.*\r\n\)*const.aint_global_gdb_e: $hex\(.*\r\n\)*"]

  gdb_test "info exceptions task" \
      [multi_line "All Ada exceptions matching regular expression