public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Relax type-printer regexp in libstdc++ test suite
@ 2023-06-28 15:57 Tom Tromey
  2023-06-28 18:05 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2023-06-28 15:57 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Tom Tromey

The libstdc++ test suite checks whether gdb type printers are
available like so:

    set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)" \
			   "\\\[\\\]"]

This regexp assumes that the list of printers is empty.  However,
sometimes it's convenient to ship a gdb that comes with some default
printers, causing this to erroneously report that gdb is "too old".

I believe the intent of this check is to ensure that gdb.type_printers
exists -- not to check its starting value.  This patch changes the
check to accept any Python list as output.

Note that the patch doesn't look for the trailing "]".  I tried this
but in my case the output was too long for expect.  It seemed fine to
just check the start, as the point really is to reject the case where
the command prints an error message.

	* testsuite/lib/gdb-test.exp (gdb-test): Relax type-printer
	regexp.
---
 libstdc++-v3/testsuite/lib/gdb-test.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp b/libstdc++-v3/testsuite/lib/gdb-test.exp
index 3728a060aa4..d8e572ef7b3 100644
--- a/libstdc++-v3/testsuite/lib/gdb-test.exp
+++ b/libstdc++-v3/testsuite/lib/gdb-test.exp
@@ -107,8 +107,12 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } {
 	}
     }
 
+    # A very old version of gdb will not have the type_printers
+    # global.  Some organizations may ship a gdb that has some default
+    # type printers, so accept any list output as indication that the
+    # global exists.
     set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)" \
-			   "\\\[\\\]"]
+			   "\\\[.+"]
     if {!$do_whatis_tests} {
 	send_log "skipping 'whatis' tests - gdb too old"
     }
-- 
2.40.1


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

* Re: [PATCH] Relax type-printer regexp in libstdc++ test suite
  2023-06-28 15:57 [PATCH] Relax type-printer regexp in libstdc++ test suite Tom Tromey
@ 2023-06-28 18:05 ` Jonathan Wakely
  2023-06-29 16:58   ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2023-06-28 18:05 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gcc-patches, libstdc++

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

On Wed, 28 Jun 2023 at 16:58, Tom Tromey via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:

> The libstdc++ test suite checks whether gdb type printers are
> available like so:
>
>     set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)"
> \
>                            "\\\[\\\]"]
>
> This regexp assumes that the list of printers is empty.  However,
> sometimes it's convenient to ship a gdb that comes with some default
> printers, causing this to erroneously report that gdb is "too old".
>
> I believe the intent of this check is to ensure that gdb.type_printers
> exists -- not to check its starting value.  This patch changes the
> check to accept any Python list as output.
>
> Note that the patch doesn't look for the trailing "]".  I tried this
> but in my case the output was too long for expect.  It seemed fine to
> just check the start, as the point really is to reject the case where
> the command prints an error message.
>


Looks good. OK for trunk, and OK to backport after some soak time on trunk.
Thanks.



>         * testsuite/lib/gdb-test.exp (gdb-test): Relax type-printer
>         regexp.
> ---
>  libstdc++-v3/testsuite/lib/gdb-test.exp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp
> b/libstdc++-v3/testsuite/lib/gdb-test.exp
> index 3728a060aa4..d8e572ef7b3 100644
> --- a/libstdc++-v3/testsuite/lib/gdb-test.exp
> +++ b/libstdc++-v3/testsuite/lib/gdb-test.exp
> @@ -107,8 +107,12 @@ proc gdb-test { marker {selector {}} {load_xmethods
> 0} } {
>         }
>      }
>
> +    # A very old version of gdb will not have the type_printers
> +    # global.  Some organizations may ship a gdb that has some default
> +    # type printers, so accept any list output as indication that the
> +    # global exists.
>      set do_whatis_tests [gdb_batch_check "python
> print(gdb.type_printers)" \
> -                          "\\\[\\\]"]
> +                          "\\\[.+"]
>      if {!$do_whatis_tests} {
>         send_log "skipping 'whatis' tests - gdb too old"
>      }
> --
> 2.40.1
>
>

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

* Re: [PATCH] Relax type-printer regexp in libstdc++ test suite
  2023-06-28 18:05 ` Jonathan Wakely
@ 2023-06-29 16:58   ` Tom Tromey
  2023-06-29 18:00     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2023-06-29 16:58 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Tom Tromey, gcc-patches, libstdc++

>>>>> Jonathan Wakely <jwakely@redhat.com> writes:

> Looks good. OK for trunk, and OK to backport after some soak time on trunk. Thanks.

AdaCore doesn't need a backport of this, and I don't think it's
extremely important; so unless you want me to do it, I don't plan to.

I did check it in on trunk earlier today.

thanks,
Tom

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

* Re: [PATCH] Relax type-printer regexp in libstdc++ test suite
  2023-06-29 16:58   ` Tom Tromey
@ 2023-06-29 18:00     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2023-06-29 18:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gcc-patches, libstdc++

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

On Thu, 29 Jun 2023 at 17:59, Tom Tromey <tromey@adacore.com> wrote:

> >>>>> Jonathan Wakely <jwakely@redhat.com> writes:
>
> > Looks good. OK for trunk, and OK to backport after some soak time on
> trunk. Thanks.
>
> AdaCore doesn't need a backport of this, and I don't think it's
> extremely important; so unless you want me to do it, I don't plan to.
>

OK, we can always backport it later if anybody else needs it.



> I did check it in on trunk earlier today.
>
>
Thanks.

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

end of thread, other threads:[~2023-06-29 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 15:57 [PATCH] Relax type-printer regexp in libstdc++ test suite Tom Tromey
2023-06-28 18:05 ` Jonathan Wakely
2023-06-29 16:58   ` Tom Tromey
2023-06-29 18:00     ` Jonathan Wakely

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