public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Rewrite skip_python_tests
Date: Fri, 13 Jan 2023 20:37:49 +0000 (GMT)	[thread overview]
Message-ID: <20230113203749.8A98E3854806@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=222ef1693c7a2abe00f0297405c8fe7e135d050e

commit 222ef1693c7a2abe00f0297405c8fe7e135d050e
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Jan 6 20:36:38 2023 -0700

    Rewrite skip_python_tests
    
    This rewrites skip_python_tests to examine the output of
    "gdb --configuration".  This is a bit nicer because it
    does not require an already-running gdb.

Diff:
---
 gdb/testsuite/lib/gdb.exp        | 24 +++---------------------
 gdb/testsuite/lib/mi-support.exp |  5 +----
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3d416f902b8..64eef9701c2 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2449,28 +2449,10 @@ proc skip_rust_tests {} {
 }
 
 # Return a 1 for configurations that do not support Python scripting.
-# PROMPT_REGEXP is the expected prompt.
 
-proc skip_python_tests_prompt { prompt_regexp } {
-    gdb_test_multiple "python print ('test')" "verify python support" \
-	-prompt "$prompt_regexp" {
-	    -re "not supported.*$prompt_regexp" {
-		unsupported "Python support is disabled."
-		return 1
-	    }
-	    -re "$prompt_regexp" {}
-	}
-
-    return 0
-}
-
-# Return a 1 for configurations that do not support Python scripting.
-# Note: This also sets various globals that specify which version of Python
-# is in use.  See skip_python_tests_prompt.
-
-proc skip_python_tests {} {
-    global gdb_prompt
-    return [skip_python_tests_prompt "$gdb_prompt $"]
+gdb_caching_proc skip_python_tests {
+    set output [remote_exec host $::GDB --configuration]
+    return [expr {[string first "--with-python" $output] == -1}]
 }
 
 # Return a 1 if we should skip shared library tests.
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 1ee087d8127..f756cbe2d73 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -2735,12 +2735,9 @@ proc mi_make_breakpoint_table {bp_list} {
 }
 
 # Return a 1 for configurations that do not support Python scripting.
-# Note: This also sets various globals that specify which version of Python
-# is in use.  See skip_python_tests_prompt.
 
 proc mi_skip_python_tests {} {
-    global mi_gdb_prompt
-    return [skip_python_tests_prompt "$mi_gdb_prompt$"]
+    return [skip_python_tests]
 }
 
 # As skip_libstdcxx_probe_tests_prompt, with mi_gdb_prompt.

                 reply	other threads:[~2023-01-13 20:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230113203749.8A98E3854806@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).