public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][pushed] Add check_effective_target_pytest3.
Date: Mon, 17 Jan 2022 11:28:40 +0100	[thread overview]
Message-ID: <1cb7d0a5-167c-d056-2ce3-317f38be8cd3@suse.cz> (raw)

Hi.

The patch is about factoring out a function similar to check_effective_target_python3.

Cheers,
Martin

gcc/testsuite/ChangeLog:

	* lib/gcov.exp: Use check_effective_target_pytest3.
	* lib/target-supports.exp: Add check_effective_target_pytest3.
---
  gcc/testsuite/lib/gcov.exp            |  9 ++++-----
  gcc/testsuite/lib/target-supports.exp | 12 ++++++++++++
  2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/lib/gcov.exp b/gcc/testsuite/lib/gcov.exp
index dfa1b3686ab..6c57515e229 100644
--- a/gcc/testsuite/lib/gcov.exp
+++ b/gcc/testsuite/lib/gcov.exp
@@ -17,6 +17,8 @@
  # Verify various kinds of gcov output: line counts, branch percentages,
  # and call return percentages.  None of this is language-specific.
  
+load_lib "target-supports.exp"
+
  global GCOV
  
  #
@@ -274,11 +276,8 @@ proc run-gcov-pytest { args } {
      set testcase [remote_download host $testcase]
      set result [remote_exec host $GCOV "$testcase -i"]
  
-    set pytest_cmd "python3 -m pytest --color=no -rap -s --tb=no"
-    set result [remote_exec host "$pytest_cmd --version"]
-    set status [lindex $result 0]
-    if { $status != 0 } then {
-      unsupported "$subdir/$testcase run-gcov-pytest python3 pytest missing"
+    if { ![check_effective_target_pytest3] } {
+      unsupported "$script pytest python3 is missing"
        return
      }
  
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 12c5ca5da33..fd48475a57c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11734,3 +11734,15 @@ proc check_effective_target_python3 { } {
          return 0;
      }
  }
+
+# Return 1 if pytest module is available for python3.
+
+proc check_effective_target_pytest3 { } {
+    set result [remote_exec host "python3 -m pytest --color=no -rap -s --tb=no --version"]
+    set status [lindex $result 0]
+    if { $status == 0 } then {
+        return 1;
+    } else {
+        return 0;
+    }
+}
-- 
2.34.1


             reply	other threads:[~2022-01-17 10:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 10:28 Martin Liška [this message]
2022-01-19  0:59 ` H.J. Lu

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=1cb7d0a5-167c-d056-2ce3-317f38be8cd3@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.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).