From patchwork Wed May 10 07:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 91936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3438574vqo; Wed, 10 May 2023 00:52:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6cNmC8qUvbFry4PJ9oJF5qNanAIuSFFWQ51gKbzXql1GQkuP9ILm14gMuBsF7lRbnp1WJB X-Received: by 2002:a17:907:a0c:b0:962:582d:89c8 with SMTP id bb12-20020a1709070a0c00b00962582d89c8mr15048539ejc.45.1683705155807; Wed, 10 May 2023 00:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683705155; cv=none; d=google.com; s=arc-20160816; b=e1Xq4v2W11YwYgrVSM7L9VikT28bkEVOaidQZTgxpCyYZDhOmoDShedxErWJA/BQ74 jx29eBq5pp9l9WcXQ6R9DY9GGaj0JCRdtAEx3CYlIRVVGw9GuOdawYduAPk/uW2zknaR 8AMnT0emp2uqtoR9C3XRQiSAywP/lw5X3DxaUu2fleMZBi31/YhLmVleQDuaPZVRtteB 7ZdWItXCYhGPdgb3myW3DKRZcWfZaRO+rm/AubJWwsdx8BcF0BvyhovWuzzvlsqCPBZq fbpWTyafKwmtTh3oNW5rbVnzY1edBHda7qeGG5DrUxaov7B7UsDmZsOEI3nYSDQOS+j0 na4A== 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=mmsRsKqac3O6/pcwzIOBashgFzthbM2d/vEoYlrA85M=; b=xJ2HLOI1xjEJVWzxu3eGLby0mbKcRZv9WukK1tfZ3/hTxuKrQn2+hzVJvCIXRz1PRF Vy9bMzUHEOVw0eEcHG8BwuRWZYR9GhuguKEMeHTmadJ/uUdad1v3KVyjNR2QGqSeRu9M UWkeJMvFnqqwFWvlHaXE8ts38O/qCJ7f0s5VU7/MPxs7YtFfrP6KD3rmlBdHOXzR2SY/ wiBJI2RmW/U+cU66x9m9ZWB+SArxyRMjlt1NhBCMQZpFneWod3mWWgMPnUV+gjb4hlBo D3TLCXZkVOJYk3n5GW/hgi+cYA5/LP0hL+VQTzlTKE29aJxW8Uo9Z5cbddGZjJySKy2V o0vw== 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 q24-20020a1709066ad800b009664809fdcfsi3123816ejs.1017.2023.05.10.00.52.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 00:52:35 -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 BF5A6385B538 for ; Wed, 10 May 2023 07:52:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 1202B3858C31 for ; Wed, 10 May 2023 07:52:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1202B3858C31 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.99,264,1677571200"; d="scan'208,223";a="4845920" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 09 May 2023 23:51:58 -0800 IronPort-SDR: wSGOJvZdk2u2BAk/QHirIYSDN/ITXo8HvcujtRk21ylu0N7518a49evlnlJfF/4X/GXQGUAC6X XNPGWOq7qNy/WK0p/zNDswX/gJSHMUYeXDT8jvVO0obCaGzWEJA20npQT0pGT+9y1NZZyJvYim i1e+jYVTisDx500U8emVkdJPJBhgEFpj6fV54/vBgqIY910T0PXgm9t5PZio6CfMDgfQWj+lw+ JxWMUz+UpHGwvXkdk8n0h0KHFxxpmUGjGQrI8x4Z6w/mO7JiHWa4GuStceCTuk87nt/Mg6nYuk tzI= From: Thomas Schwinge To: Christophe Lyon , CC: Richard Biener , Jan Hubicka , "Rainer Orth" , Mike Stump Subject: Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init' (was: Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage (was: Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS')) In-Reply-To: References: <20110927172322.GA21068@kam.mff.cuni.cz> <875y99d5rt.fsf@euler.schwinge.homeip.net> <87lehxswug.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 10 May 2023 09:51:50 +0200 Message-ID: <87fs84sjxl.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.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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?1765492817733955529?= X-GMAIL-MSGID: =?utf-8?q?1765492817733955529?= Hi Christophe! On 2023-05-09T21:14:07+0200, Christophe Lyon wrote: > On Tue, 9 May 2023 at 17:17, Christophe Lyon > wrote: >> On Tue, 9 May 2023 at 11:00, Thomas Schwinge >> wrote: >>> On 2023-05-09T09:32:55+0200, Christophe Lyon >>> wrote: >>> > On Wed, 3 May 2023 at 13:47, Richard Biener via Gcc-patches < >>> gcc-patches@gcc.gnu.org> wrote: >>> >> On Wed, 3 May 2023, Thomas Schwinge wrote: >>> >> > "Let each 'lto_init' determine the default 'LTO_OPTIONS', and >>> 'torture-init' the 'LTO_TORTURE_OPTIONS'"? >>> > >>> > This is causing issues on arm/aarch64, including: >>> > >>> > ERROR: can't read "LTO_TORTURE_OPTIONS": no such variable >>> > in gcc.target/arm/acle/acle.exp: >>> > >>> > ERROR: torture-init: LTO_TORTURE_OPTIONS is not empty as expected >>> > in gcc.target/aarch64/sls-mitigation/sls-mitigation.exp, >>> > gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp, >>> > gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp, >>> > gcc.target/aarch64/torture/aarch64-torture.exp >>> > >>> > and maybe others >>> > >>> > Are other targets affected too? >>> >>> Sorry for that -- it means, the safe-guards I added are working as >>> expected. >>> >>> Please test whether all these issues are gone with the attached >>> "Testsuite: Add missing 'torture-init'/'torture-finish' around >>> 'LTO_TORTURE_OPTIONS' usage"? >> >> Your patch seemed reasonable, but it doesn't work :-( >> >> Well now I get: >> ERROR: torture-init: LTO_TORTURE_OPTIONS is not empty as expected >> because gcc-dg-runtest itself calls torture-init >> >> but I'm not sure where LTO_TORTURE_OPTIONS is set > > Just checking, are you able to test your changes on arm (a cross toolchain > is OK) ? Sorry, I don't currently have an arm/aarch64 toolchain built. > The problem shows up even if running only acle.exp, so it's quick once you > have built the toolchain once. I did a quick hack: --- gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp +++ gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp @@ -22,3 +21,0 @@ -if {![istarget aarch64*-*-*] } then { - return -} --- gcc/testsuite/gcc.target/arm/acle/acle.exp +++ gcc/testsuite/gcc.target/arm/acle/acle.exp @@ -20,3 +19,0 @@ -if ![istarget arm*-*-*] then { - return -} ..., and confirm to run into the DejaGnu/TCL ERRORs in my x86_64-pc-linux-gnu testing. > I spent some time looking at it, and the conflict is that the .exp file > calls torture-init and gcc-dg-runtest, which in turn calls torture-init > again, leading to the error. I see, thanks -- and sorry, once again. > I haven't checked the details of why there are similar failures on aarch64. I now understand that the problem is the following: most of all '*.exp' files have 'torture-init' followed by 'set-torture-options' before 'gcc-dg-runtest' etc., and therefore don't run into the latter's "Some callers set torture options themselves; don't override those." code. Some '*.exp' files however do 'torture-init' but not 'set-torture-options', and therefore we can't any longer conditionalize the implicit 'torture-init' by '![torture-options-exist]'. Please in addition to the earlier "Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage" also apply the attached "Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init'". That hopefully should restore sanity -- if not, I'll get arm/aarch64 toolchains built. 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 4a069073834c5b710e17315c0844f1212fa54164 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 10 May 2023 09:17:47 +0200 Subject: [PATCH] Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init' Recent commit d6654a4be3ba44c0d57be7c8a51d76d9721345e1 "Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS'" made 'torture-init' non-idempotent re 'LTO_TORTURE_OPTIONS', in order to catch certain classes of errors. Now, most of all '*.exp' files have 'torture-init' followed by 'set-torture-options' before 'gcc-dg-runtest' etc., and therefore don't run into the latter's "Some callers set torture options themselves; don't override those." code. Some '*.exp' files however do 'torture-init' but not 'set-torture-options', and therefore we can't any longer conditionalize the implicit 'torture-init' by '![torture-options-exist]'. gcc/testsuite/ * lib/torture-options.exp (torture-init-done): Add. * lib/gcc-dg.exp (gcc-dg-runtest): Use it to conditionalize implicit 'torture-init'. * lib/gfortran-dg.exp (gfortran-dg-runtest): Likewise. * lib/obj-c++-dg.exp (obj-c++-dg-runtest): Likewise. * lib/objc-dg.exp (objc-dg-runtest): Likewise. --- gcc/testsuite/lib/gcc-dg.exp | 8 ++++++-- gcc/testsuite/lib/gfortran-dg.exp | 8 ++++++-- gcc/testsuite/lib/obj-c++-dg.exp | 8 ++++++-- gcc/testsuite/lib/objc-dg.exp | 8 ++++++-- gcc/testsuite/lib/torture-options.exp | 6 ++++++ 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 693cbdd7511..4ed4233efff 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -568,11 +568,15 @@ proc search_for { file pattern } { proc gcc-dg-runtest { testcases flags default-extra-flags } { global runtests + # Some callers initialize torture testing themselves; don't override those. + set existing_torture_init [torture-init-done] + if { $existing_torture_init == 0 } { + torture-init + } # Some callers set torture options themselves; don't override those. set existing_torture_options [torture-options-exist] if { $existing_torture_options == 0 } { global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS - torture-init set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS } dump-torture-options @@ -603,7 +607,7 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } { } } - if { $existing_torture_options == 0 } { + if { $existing_torture_init == 0 } { torture-finish } } diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp index 3c813d3c8fb..e85f791fa94 100644 --- a/gcc/testsuite/lib/gfortran-dg.exp +++ b/gcc/testsuite/lib/gfortran-dg.exp @@ -126,11 +126,15 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } { global runtests global torture_with_loops + # Some callers initialize torture testing themselves; don't override those. + set existing_torture_init [torture-init-done] + if { $existing_torture_init == 0 } { + torture-init + } # Some callers set torture options themselves; don't override those. set existing_torture_options [torture-options-exist] if { $existing_torture_options == 0 } { global DG_TORTURE_OPTIONS - torture-init set-torture-options $DG_TORTURE_OPTIONS } dump-torture-options @@ -160,7 +164,7 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } { } } - if { $existing_torture_options == 0 } { + if { $existing_torture_init == 0 } { torture-finish } } diff --git a/gcc/testsuite/lib/obj-c++-dg.exp b/gcc/testsuite/lib/obj-c++-dg.exp index 9123240f033..8deaed005dc 100644 --- a/gcc/testsuite/lib/obj-c++-dg.exp +++ b/gcc/testsuite/lib/obj-c++-dg.exp @@ -32,11 +32,15 @@ proc obj-c++-dg-prune { system text } { proc obj-c++-dg-runtest { testcases flags default-extra-flags } { global runtests + # Some callers initialize torture testing themselves; don't override those. + set existing_torture_init [torture-init-done] + if { $existing_torture_init == 0 } { + torture-init + } # Some callers set torture options themselves; don't override those. set existing_torture_options [torture-options-exist] if { $existing_torture_options == 0 } { global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS - torture-init set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS } dump-torture-options @@ -67,7 +71,7 @@ proc obj-c++-dg-runtest { testcases flags default-extra-flags } { } } - if { $existing_torture_options == 0 } { + if { $existing_torture_init == 0 } { torture-finish } } \ No newline at end of file diff --git a/gcc/testsuite/lib/objc-dg.exp b/gcc/testsuite/lib/objc-dg.exp index 9ca751c8f48..cf08cdcabbd 100644 --- a/gcc/testsuite/lib/objc-dg.exp +++ b/gcc/testsuite/lib/objc-dg.exp @@ -33,11 +33,15 @@ proc objc-dg-prune { system text } { proc objc-dg-runtest { testcases flags default-extra-flags } { global runtests + # Some callers initialize torture testing themselves; don't override those. + set existing_torture_init [torture-init-done] + if { $existing_torture_init == 0 } { + torture-init + } # Some callers set torture options themselves; don't override those. set existing_torture_options [torture-options-exist] if { $existing_torture_options == 0 } { global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS - torture-init set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS } dump-torture-options @@ -68,7 +72,7 @@ proc objc-dg-runtest { testcases flags default-extra-flags } { } } - if { $existing_torture_options == 0 } { + if { $existing_torture_init == 0 } { torture-finish } } diff --git a/gcc/testsuite/lib/torture-options.exp b/gcc/testsuite/lib/torture-options.exp index 394418e9a02..d00d07e9378 100644 --- a/gcc/testsuite/lib/torture-options.exp +++ b/gcc/testsuite/lib/torture-options.exp @@ -51,6 +51,12 @@ proc torture-init { args } { } } +# Return 1 if 'torture-init' has already been done, 0 otherwise. +proc torture-init-done { args } { + global LTO_TORTURE_OPTIONS + return [info exists LTO_TORTURE_OPTIONS] +} + # Return 1 if torture options have already been set, 0 otherwise. proc torture-options-exist { args } { global torture_with_loops -- 2.34.1