Re: [PATCH] gdb/testsuite: Add gdb_test_multiple_name variable

Keith Seitz
2019-10-01T17:41:43Z

On 10/1/19 10:28 AM, Andrew Burgess wrote:
> After this patch you can now write this:
>
> gdb_test_multiple "print foo" "test foo" {
> -re "expected output 1" {
> pass $gdb_test_multiple_name
> }
> -re "expected output 2" {
> fail $gdb_test_multiple_name
> }
> }

OMG, why didn't *I* think of that!?!

> The $gdb_test_multiple_name is setup by gdb_test_multiple, and cleaned
> up once the test has completed. Nested calls to gdb_test_multiple are
> supported, though $gdb_test_multiple_name will only ever contain the
> inner most test message (which is probably what you want).

Your patch looks good to me (but I am not a maintainer), but I wanted to
ask if you considered using a stack to more robustly solve the nesting
problem? It might be unnecessary today -- even overkill -- but I
would think it is much easier on the eyes.

We have such support in the test suite already. See
testsuite/lib/data-structures.exp. [I am not suggesting any
changes, just trying to raise awareness for ::Stack et al usage
in the test suite.]

Keith