From patchwork Wed Mar 29 19:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 76792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp653087vqo; Wed, 29 Mar 2023 13:00:08 -0700 (PDT) X-Google-Smtp-Source: AKy350a+1ebob4+2+sF+9PTg0gQh0DScK/Z1yv430MOeu0O+ad/fZZpEHtpDWVCPbVrpWxzJdGzL X-Received: by 2002:a17:906:2695:b0:920:7827:302 with SMTP id t21-20020a170906269500b0092078270302mr3245774ejc.18.1680120007853; Wed, 29 Mar 2023 13:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680120007; cv=none; d=google.com; s=arc-20160816; b=nbKDQX55N8KSrXW7JV+F4x+TrOKjFoi9CcPkqSww+HuZw3gsDjPZh7f1xgKF0zWpTa f9bTR54McRXB0FTbnc4gDG08khCfEIHCQvvw/GsrAzJcFnGE5oBkqP/u0yeSB5CMX+7i HryKue/67YyBLPuQruYRVhSj5H6+Qa462kurVYJbJW6QtB78dd3XqPByOFdBEhuafvXg yAGz0HROQEKDyiU8qecKOTBhcnRCPAUoGetucr8QGnMC9SXku9tfwYnMnt+GwkDzVlDM PDLvEeWZ16863rQQeKjtR7lN/b3bGuLSsG5PJwlHFQlYXWqlngszbQzfBEzwLS/ZOXlM Asjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=ZjSVMfuIqSGHjHxPmboxRPtytG568XAXSb0LdSESFNc=; b=kisEO7/jxCWLhFpbvS6A4ip2s6jXKgvJ/HFFZhYe7Xw2z3zsRFxZddFvmCbgSerEIE t2hpqnmXUZhQlaBbOK0+SkYo0+fUDZJ6gSsuu0C7qFuuHhB8x4arO52cG80u29oOHypA pSWqot5YHxYMARSZNlQmrxmt+CBk/y5DJJJNJJnODDAYxdHV84YeKuUbzDBWHu9e1UwJ pW/3RKW7mUZyWEUnSiR2MelFsebVqtF8A+lOAisW+b5pKWpc8FQ2cF9dHUWEZOUy3BzR /5gytp5397NrC3NSXl4ycmAUpNHMYAcKGkGDOZfWr+neIL2BHC9ix3eZSt0qcZugzuua GmSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id dm14-20020a170907948e00b00944010e04fasi13328651ejc.712.2023.03.29.13.00.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 13:00:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 398613858033 for ; Wed, 29 Mar 2023 19:59:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 6657F3858D1E for ; Wed, 29 Mar 2023 19:59:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6657F3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208,223";a="930923" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 29 Mar 2023 11:59:27 -0800 IronPort-SDR: zjLoqD4gByiycxYyhMgTed8JWdfLYPNLMsjW3CDSUUBtXal8pCXPQdzpHXwC2or+V3x3UErs5Q xgWvGMyCmqs6P/N4ddc6QKZja0+TdNGfrRRuI5S7WTPaTxdow9ceyfAYXltoK2YAKmDwpOo6/N ozQw+igiI5xlDqxfbrL6j2PznKDfAGBmJUILKp5g+/QcruC2RtgZSpDw4jmydSY3PTGJvYKahQ NV3MkoqiRogs5rfBm4q710sIvUfHd0taEXy0EtPADJ6i8JVrrzdohyXr+0ho0pnXXh9Yrk8yqn naw= From: Thomas Schwinge To: , Jakub Jelinek , "Richard Biener" , Jason Merrill , "Alexandre Oliva" , , CC: Subject: 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] (was: [PATCH] testsuite: Fix up modules.exp [PR108899]) In-Reply-To: References: <00f5cbe1-05b7-0e42-0b46-1e36d1e4e8b3@redhat.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 29 Mar 2023 21:59:20 +0200 Message-ID: <87o7ob2usn.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761733517400989418?= X-GMAIL-MSGID: =?utf-8?q?1761733517400989418?= Hi! This changed needs more attention I'm afraid: On 2023-02-23T15:18:04+0100, Jakub Jelinek via Gcc-patches wrote: > On Wed, Feb 22, 2023 at 02:33:42PM -0300, Alexandre Oliva via Gcc-patches wrote: >> When a multi-source module is found to be unsupported, we fail >> module_cmi_p and subsequent sources. Override proc unsupported to >> mark the result in module_do, and test it to skip module_cmp_p and >> subsequent related tests. >> >> for gcc/testsuite/ChangeLog >> >> * g++.dg/modules/modules.exp: Override unsupported to update >> module_do, and test it after dg-test. That's commit r13-6288-g5344482c4d3ae0618fa8f5ed38f8309db43fdb82 "testsuite: Skip module_cmi_p and related unsupported module test": --- gcc/testsuite/g++.dg/modules/modules.exp +++ gcc/testsuite/g++.dg/modules/modules.exp @@ -315,6 +315,17 @@ proc module-check-requirements { tests } { # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] +# Override unsupported to set the second element of module_do to "N", +# so that, after an unsupported result in dg-test, we can skip rather +# than fail subsequent related tests. +set module_do {"compile" "P"} +rename unsupported saved-unsupported +proc unsupported { args } { + global module_do + lset module_do 1 "N" + return [saved-unsupported $args] +} + # not grouped tests, sadly tcl doesn't have negated glob foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \ "$srcdir/$subdir/*_?.\[CH\]"] { @@ -327,6 +338,9 @@ foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]] \ set module_cmis {} verbose "Testing $nshort $std" 1 dg-test $test "$std" $DEFAULT_MODFLAGS + if { [lindex $module_do 1] == "N" } { + continue + } set testcase [string range $test [string length "$srcdir/"] end] cleanup_module_files [module_cmi_p $testcase $module_cmis] } @@ -372,6 +386,9 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { } } dg-test -keep-output $test "$std" $DEFAULT_MODFLAGS + if { [lindex $module_do 1] == "N" } { + break + } set testcase [string range $test [string length "$srcdir/"] end] lappend mod_files [module_cmi_p $testcase $module_cmis] } First, I'm seeing this change my 'g++.dg/modules/modules.exp' '*.sum' output as follows: -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17 PASS: g++.dg/modules/explicit-bool-1_a.H -std=c++2a (test for excess errors) PASS: g++.dg/modules/explicit-bool-1_a.H -std=c++2b (test for excess errors) -UNSUPPORTED: g++.dg/modules/explicit-bool-1_b.C -std=c++17 PASS: g++.dg/modules/explicit-bool-1_b.C -std=c++2a (test for excess errors) PASS: g++.dg/modules/explicit-bool-1_b.C -std=c++2b (test for excess errors) PASS: g++.dg/modules/export-1.C -std=c++17 (test for errors, line 10) @@ -7247,6 +7245,7 @@ PASS: g++.dg/modules/xtreme-tr1_b.C -std=c++17 (test for excess errors) PASS: g++.dg/modules/xtreme-tr1_b.C -std=c++2a (test for excess errors) PASS: g++.dg/modules/xtreme-tr1_b.C -std=c++2b (test for excess errors) +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17} I assume that the second UNSUPPORTED: -UNSUPPORTED: g++.dg/modules/explicit-bool-1_b.C -std=c++17 ... disappears is the intention of this patch? But surely the curly braces in: -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17 +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17} ... are not intentional? (Alexandre?) But worse, the latter also "bleeds into" all other testing that's executing as part of the same 'runtest' invocation (that is, further '*.exp' files). (I've ranted before about how much I don't like this aspect of DejaGnu/'runtest'...) For example (random; there are many, many more): [...] PASS: c-c++-common/tsan/sanitize-thread-macro.c -O0 (test for excess errors) -UNSUPPORTED: c-c++-common/tsan/sanitize-thread-macro.c -O2 [...] PASS: g++.dg/tsan/pr88018.C -O0 (test for excess errors) -UNSUPPORTED: g++.dg/tsan/pr88018.C -O2 [...] +UNSUPPORTED: {c-c++-common/tsan/sanitize-thread-macro.c -O2 } +UNSUPPORTED: {g++.dg/tsan/pr88018.C -O2 } [...] That's undesirable. Per Jakub: > This patch breaks testing with more than one set of options in > target board, like > make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp' > yields: > ... > === g++ Summary for unix/-m32 === > > # of expected passes 7217 > # of unexpected failures 1 > # of expected failures 18 > # of unsupported tests 2 > Running target unix/-m64 > ... > ERROR: tcl error sourcing /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp. > ERROR: tcl error code TCL OPERATION RENAME TARGET_EXISTS > ERROR: can't rename to "saved-unsupported": command already exists > while executing > "rename unsupported saved-unsupported" > (file "/home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" line 322) > invoked from within > "source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" > ("uplevel" body line 1) > invoked from within > "uplevel #0 source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" > invoked from within > "catch "uplevel #0 source $test_file_name" msg" ACK. > In other spots where we in *.exp files rename some routine, we guard that ACK, but that's -- as far as I can tell -- done for procs that are then used only locally, or where all global use should use the 'rename'd proc. However, we don't globally want 'UNSUPPORTED: {[...]}' (... in 'runtest' invocations where 'g++.dg/modules/modules.exp' happened to have ran before...), so... > and the following patch does that for modules.exp too. > > Tested with running > make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp' > again which now works properly again. > PR testsuite/108899 > * g++.dg/modules/modules.exp: Only override unsupported if it > exists and saved-unsupported doesn't. > > --- gcc/testsuite/g++.dg/modules/modules.exp.jj 2023-02-22 20:50:34.208421799 +0100 > +++ gcc/testsuite/g++.dg/modules/modules.exp 2023-02-23 13:07:40.207320104 +0100 > @@ -319,11 +319,15 @@ cleanup_module_files [find $DEFAULT_REPO > # so that, after an unsupported result in dg-test, we can skip rather > # than fail subsequent related tests. > set module_do {"compile" "P"} > -rename unsupported saved-unsupported > -proc unsupported { args } { > - global module_do > - lset module_do 1 "N" > - return [saved-unsupported $args] > +if { [info procs unsupported] != [list] \ > + && [info procs saved-unsupported] == [list] } { > + rename unsupported saved-unsupported > + > + proc unsupported { args } { > + global module_do > + lset module_do 1 "N" > + return [saved-unsupported $args] > + } > } ..., this isn't sufficient. Instead, we should undo the 'rename' at the end of 'g++.dg/modules/modules.exp'. OK to push the attached "'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]" after proper testing? And, Alexandre, please have a look at the -- now local to 'g++.dg/modules/modules.exp' -- issue about curly braces in 'UNSUPPORTED: [...]' -> 'UNSUPPORTED: {[...]}'? Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From b5c6fae2467cf4245f379269792559b8c00eca58 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 29 Mar 2023 21:11:19 +0200 Subject: [PATCH] 'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899] Fix-up for commit 5344482c4d3ae0618fa8f5ed38f8309db43fdb82 "testsuite: Skip module_cmi_p and related unsupported module test". PR testsuite/108899 gcc/testsuite/ * g++.dg/modules/modules.exp: Don't leak local 'unsupported' proc. --- gcc/testsuite/g++.dg/modules/modules.exp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index e66b2082f20..23c4bac2e89 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -408,4 +408,8 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { } } +# Restore the saved 'unsupported' proc. +rename unsupported {} +rename saved-unsupported unsupported + dg-finish -- 2.25.1