From patchwork Mon Jan 17 10:28:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 50100 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 42665385800E for ; Mon, 17 Jan 2022 10:29:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 3131E3858017 for ; Mon, 17 Jan 2022 10:28:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3131E3858017 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 172E71F39A for ; Mon, 17 Jan 2022 10:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642415321; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lH516TC68sptvuxxCZbu6wEu/a7KggjFzSeU48EUtRU=; b=Yn/ok6R2SozL9C3YvrZtnhygvZQrdhPW8HwLMIH9wf/dU70RofXs/m6Mz7CjDbJz+so+jO 2+S9skvJtrpM2zixOQZQcUPjL7f2OwH6pGPaIVPFwzeVmZzIuD9uNHdagzLEsn2y4UTnCb VozkJNRpvxp6kp3JddAIgmxEqWrsKG4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642415321; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lH516TC68sptvuxxCZbu6wEu/a7KggjFzSeU48EUtRU=; b=fmA6r2sSTKK4vPuqZNjqiH8C6bfYFY6PDwM8Lh97yOB9+dfyu8XuUf/NAt2N6Ydo8JFoUB XkiiDGeroxShi3CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 07BD013B4E for ; Mon, 17 Jan 2022 10:28:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KXriANlE5WFXWAAAMHmgww (envelope-from ) for ; Mon, 17 Jan 2022 10:28:41 +0000 Message-ID: <1cb7d0a5-167c-d056-2ce3-317f38be8cd3@suse.cz> Date: Mon, 17 Jan 2022 11:28:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH][pushed] Add check_effective_target_pytest3. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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; + } +}