From patchwork Tue May 9 12:54:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 91589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2857252vqo; Tue, 9 May 2023 05:55:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Z3W6HtSfsDGscvBD1Jnur7MlCZG2lK5Zw0/j9AYYmI0ex+JHJ/A6R9wNrgc76GkDwWGtg X-Received: by 2002:aa7:dd11:0:b0:506:2c70:3066 with SMTP id i17-20020aa7dd11000000b005062c703066mr10691198edv.21.1683636925891; Tue, 09 May 2023 05:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683636925; cv=none; d=google.com; s=arc-20160816; b=tdkF5TKEHHMacvnjleB3wSKjd2fNqzl7d52YmYkC9215JfeqRcZ6BaC6bTcC/RV4tP qUzdcmdDfTgJ7DPNSWVuAMKu1K7s4/rq7EMDYjZDTS6/qeRe/CgHW49eaH4Q/8rSMNQA lPpduAEtiN7D3nFoKTBYRFgIkJpc0avSeMrHtyuxBjcfBAH2C41WDOepfmVAzE4665+2 18+jMtHOzGUHQwkS3BzezxwVCAvUny1IUaGSkVqgWRySlip1+N94Ug0mfYTd+ewxFGsN CCSxZ094h18Xv2oQUP1GghSGjztb2ImzKWo2OC9V30XX9XAdj21K2InAU+YmCvtFJ9BF WnGg== 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=fhdb4mjcRXCLoED9tZVyiQ/8ME5ver1COFr1Jh1kWhk=; b=uqzyUNHkikCLeNi2XYfWpnIYT8ADdpqtQe6V0pRfS/uPrd4PAvf+QkJIai2QypRsHe 082W8oY/wVaMle+19QjM7hfYDVjUR0novk2liJr8/5vlPLiGDvrvgux81Q9yKp/X0zVS bALejQTzykAKsZDPR/Q23joFsRoFxm2ZW7+7pLnQ1xyumEWXaTF7f4RuAhyAPSkFhuP3 sMCuyOte3kgQlKpTbC1uoaO4hneipfUZc6OmEV3j3GhjKP1FRlOr0a96vWootdV4OZqU oLVUPq9TC4Ia1aUlVfNexVQiFzxS1pHha1iUwWCld+3O50S7jhyMFAUo6mRRBHP3kGh6 VekQ== 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u23-20020a05640207d700b004fe9345386esi1002323edy.585.2023.05.09.05.55.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 05:55:25 -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 396B33857726 for ; Tue, 9 May 2023 12:55:03 +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 3A9773858D37 for ; Tue, 9 May 2023 12:54:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A9773858D37 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,262,1677571200"; d="scan'208,223";a="5325679" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 09 May 2023 04:54:34 -0800 IronPort-SDR: ogBJ/JHLnZGUGuZZubp7SvHzNNd/BE4gHDftAl2fhJ/rQ612GUEEdpjnIdt9PrGIw6pmFEM6XO si1UHOSwQXB5lU2aZMkBKOUbgL6OY2kJhRAIuHgZDC0f6uDwmiAGwNVTPmmWzSOe0lpuNpjU/N 3lTjr1kp+eIcFmog4FG1PgGVAD2n5Ir2jOCtpc3+rH/u44NHWYueeb0GM7IRed9DHSeM7rjLKK SLEXpokRc04URzG005gOXNL+Fb+qdc5jQSm48AO6+2LxFu9j0/0Boa0d5Y+KgL5ddi7ZQYnCXW 5T0= From: Thomas Schwinge To: Mike Stump , CC: Jakub Jelinek , Rainer Orth , Tobias Burnus Subject: libgomp testsuite: Localize 'lang_[...]' etc. (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?) In-Reply-To: References: <87h9z5wd1z.fsf@schwinge.name> <87y4rrrwnc.fsf@schwinge.name> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Tue, 9 May 2023 14:54:21 +0200 Message-ID: <87ttwlacn6.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) 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?1765421272933987547?= X-GMAIL-MSGID: =?utf-8?q?1765421272933987547?= Hi! On 2014-11-04T10:31:37-0800, Mike Stump wrote: > I wonder if any variables that you set that need to be cleared out are, that seems a defect in the api or conventions we use and it can screw following tests with a wrong environment in subtle ways. I could miss accidental bleed over from the .exp you’re modifying into other unrelated parts of the test suite. Aye, that topic keeps coming back... ;-\ I'm not aware of any such defects in my changes, but I do agree that the current structure of the libgomp testsuite is a bit weird in that regard: that every '*.exp' file begins with a bunch of conditional 'unset lang_[...]' to clean up what the previous '*.exp' file left behind. I propose to simplify this as per the attached "libgomp testsuite: Localize 'lang_[...]' etc." -- OK to push? (That's a new patch, loosely based on/extracted out of my earlier work. I'm posting it separately, but given that it's in line with my earlier work (just a separate step), I intend to push it soon, unless there are any objections, of course.) 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 6230d3b0aef9b785c7d62c512e8939cca183fdb4 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 9 May 2023 10:09:35 +0200 Subject: [PATCH] libgomp testsuite: Localize 'lang_[...]' etc. ..., instead of letting them bleed into the next '*.exp' file, requiring clean-up there. libgomp/ * testsuite/libgomp.c++/c++.exp: Localize 'lang_[...]' etc. * testsuite/libgomp.c/c.exp: Likewise. * testsuite/libgomp.fortran/fortran.exp: Likewise. * testsuite/libgomp.graphite/graphite.exp: Likewise. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. --- libgomp/testsuite/libgomp.c++/c++.exp | 11 ++++++++--- libgomp/testsuite/libgomp.c/c.exp | 11 ----------- libgomp/testsuite/libgomp.fortran/fortran.exp | 15 ++++++++++----- libgomp/testsuite/libgomp.graphite/graphite.exp | 11 ----------- libgomp/testsuite/libgomp.oacc-c++/c++.exp | 11 ++++++++--- libgomp/testsuite/libgomp.oacc-c/c.exp | 11 ----------- .../testsuite/libgomp.oacc-fortran/fortran.exp | 15 ++++++++++----- 7 files changed, 36 insertions(+), 49 deletions(-) diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index 7dd2d49d568..442e9f744d0 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -7,9 +7,6 @@ set shlib_ext [get_shlib_extension] set lang_link_flags "-lstdc++" set lang_test_file_found 0 set lang_library_path "../libstdc++-v3/src/.libs" -if [info exists lang_include_flags] then { - unset lang_include_flags -} # If a testcase doesn't have special options, use these. if ![info exists DEFAULT_CFLAGS] then { @@ -71,5 +68,13 @@ if { $lang_test_file_found } { # See above. set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST" +if [info exists lang_include_flags] then { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. dg-finish diff --git a/libgomp/testsuite/libgomp.c/c.exp b/libgomp/testsuite/libgomp.c/c.exp index e67adc8b378..0ee28ed723e 100644 --- a/libgomp/testsuite/libgomp.c/c.exp +++ b/libgomp/testsuite/libgomp.c/c.exp @@ -1,14 +1,3 @@ -if [info exists lang_library_path] then { - unset lang_library_path - unset lang_link_flags -} -if [info exists lang_test_file_found] then { - unset lang_test_file_found -} -if [info exists lang_include_flags] then { - unset lang_include_flags -} - load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index 5e8e15e7743..7ea00a25bd9 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -8,12 +8,7 @@ global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] set lang_library_path "../libgfortran/.libs" set lang_link_flags "-lgfortran -foffload=-lgfortran" -if [info exists lang_include_flags] then { - unset lang_include_flags -} set lang_test_file_found 0 -set quadmath_library_path "../libquadmath/.libs" - # Initialize dg. dg-init @@ -44,6 +39,7 @@ if { $lang_test_file_found } { set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] if { $blddir != "" } { + set quadmath_library_path "../libquadmath/.libs" if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" @@ -54,6 +50,7 @@ if { $lang_test_file_found } { } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } + unset quadmath_library_path } else { set ld_library_path "$always_ld_library_path" if { [check_no_compiler_messages has_libquadmath executable { @@ -71,5 +68,13 @@ if { $lang_test_file_found } { gfortran-dg-runtest $tests "" "" } +if { $blddir != "" } { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. dg-finish diff --git a/libgomp/testsuite/libgomp.graphite/graphite.exp b/libgomp/testsuite/libgomp.graphite/graphite.exp index 1c5ea663af3..ff53a31272c 100644 --- a/libgomp/testsuite/libgomp.graphite/graphite.exp +++ b/libgomp/testsuite/libgomp.graphite/graphite.exp @@ -14,17 +14,6 @@ # along with GCC; see the file COPYING3. If not see # . -if [info exists lang_library_path] then { - unset lang_library_path - unset lang_link_flags -} -if [info exists lang_test_file_found] then { - unset lang_test_file_found -} -if [info exists lang_include_flags] then { - unset lang_include_flags -} - load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index 24ab8bb35ff..5d9dc5d4a3f 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -17,9 +17,6 @@ set shlib_ext [get_shlib_extension] set lang_link_flags "-lstdc++" set lang_test_file_found 0 set lang_library_path "../libstdc++-v3/src/.libs" -if [info exists lang_include_flags] then { - unset lang_include_flags -} # Initialize dg. dg-init @@ -152,6 +149,14 @@ if { $lang_test_file_found } { # See above. set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST" +if [info exists lang_include_flags] then { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. torture-finish dg-finish diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp index 8a960aafadc..ca61a82937a 100644 --- a/libgomp/testsuite/libgomp.oacc-c/c.exp +++ b/libgomp/testsuite/libgomp.oacc-c/c.exp @@ -1,16 +1,5 @@ # This whole file adapted from libgomp.c/c.exp. -if [info exists lang_library_path] then { - unset lang_library_path - unset lang_link_flags -} -if [info exists lang_test_file_found] then { - unset lang_test_file_found -} -if [info exists lang_include_flags] then { - unset lang_include_flags -} - load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp load_gcc_lib torture-options.exp diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index a56c7d90350..1ac2320ec22 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -10,12 +10,7 @@ global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] set lang_library_path "../libgfortran/.libs" set lang_link_flags "-lgfortran -foffload=-lgfortran" -if [info exists lang_include_flags] then { - unset lang_include_flags -} set lang_test_file_found 0 -set quadmath_library_path "../libquadmath/.libs" - # Initialize dg. dg-init @@ -46,6 +41,7 @@ if { $lang_test_file_found } { set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] if { $blddir != "" } { + set quadmath_library_path "../libquadmath/.libs" if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" @@ -56,6 +52,7 @@ if { $lang_test_file_found } { } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } + unset quadmath_library_path } else { set ld_library_path "$always_ld_library_path" if { [check_no_compiler_messages has_libquadmath executable { @@ -120,5 +117,13 @@ if { $lang_test_file_found } { unset offload_target } +if { $blddir != "" } { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. dg-finish -- 2.34.1