From patchwork Tue May 9 12:59:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 91592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2860607vqo; Tue, 9 May 2023 06:00:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54CatjxCs5a6/0Qw3doGNEp7jgUrBblsmusJ9VU/fSOTEOYYJ48+oOeoe4Hxkc1TEPeuB1 X-Received: by 2002:a05:6402:4405:b0:50b:2088:3533 with SMTP id y5-20020a056402440500b0050b20883533mr14110515eda.1.1683637253695; Tue, 09 May 2023 06:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683637253; cv=none; d=google.com; s=arc-20160816; b=hVU7FaMW4WYOm2vHOLoCdNNl0gQ0kyd5eRHPUzqF6ssPouW2buBMB6kF8Lj2fFjyo3 NkhAFcSvdzymotOS4BsGcnd+8PgVxUffeGaeuHlrAA8gzdpVjSPoNae1ulgS4rnWyRte zw1LW+u1fITTE5sAwnqirjzqG8ydOYbfhbv2dKkCm+sYbgm4YoqJAL7yqusXgL873Lrr LZPSlDODbGwVRM0s3cOKqx4lI7bpdzqZWVIdsyHXip1ztZQS95pNwVFbSmxYV9x7G1/4 0ns8SDyvUDM8qIXuHeuQUexvp6hXBt/oTGdUd04hLGVY+lHOgrP3PYyVam6QdnAWbvDY +NyQ== 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=c66xAF+8fKL9L3Zb4JwRzkNyM5H/wSbivx7wpharBkU=; b=rmlIY2LVGNRX1k4VJxCKiVaQ8fE0IiwJ/wmULWjJ9QO7bUm+8zL/WJD+KVG9qQoxGm 20+WfgSYIP0tC2TviN8ob8mmRRDOGf1KZZ3K4kbi2tlibLb0xyrt9qPIPQFP5wS9E5MK BtjOIfjciwdvhu/6Nw0c6aNHXKQ7MAscdizPz2k+FCBeRnTF/Scs/ym5VZDh5PEVe6X+ +d2Tm3TbXBneM3FBs67uJVK/qJZRnN5cp4TUByOLBvRfuWnHjTC/+YHdGqFaRAo2X8LX rqXI42Ox+wKcdWaaulWTciSPiaOnbhX5c40BZi3VXy3tYOaw2EFjvFwZwj3dg5sfNK0Q NQhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e26-20020a50fb9a000000b00509e78d52d2si1242293edq.71.2023.05.09.06.00.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 06:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 65D5B3856DE2 for ; Tue, 9 May 2023 13:00:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 601DF3858414 for ; Tue, 9 May 2023 13:00:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 601DF3858414 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="4729903" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 09 May 2023 05:00:01 -0800 IronPort-SDR: hInM38G46LBmYGujnx1ej4LGuGEIYYrXKooQ+HkvnzeZWd1Lk34Vr8lpHGubDIAr0QV8A7DQXW /rrdDgHx8YkXFVFP7RMgUf359mVM8ccOwasN27rcGoB1/5V7boU5FgJ6gfSZHR3fwMlsJMDVF9 /Bmrd/agujcAJeUnUsFI7XnLYYHwjCaitULSmWv4YZrdx6cSVPhjwajtY4UDYEtlixnmNoQyr6 rg92/ECL7CsDnHTQneRQSMRJNsAYxlI0p+ckRBGIybp2+WmkWtCP0BiXeA5QLWtkh/kZPLVocx mNE= From: Thomas Schwinge To: CC: Mike Stump , Jakub Jelinek , Rainer Orth , Tobias Burnus Subject: libgomp C++, Fortran testsuites: Resolve 'lang_test_file_found' first (was: libgomp testsuite: Localize 'lang_[...]' etc. (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?)) In-Reply-To: <87ttwlacn6.fsf@euler.schwinge.homeip.net> References: <87h9z5wd1z.fsf@schwinge.name> <87y4rrrwnc.fsf@schwinge.name> <87ttwlacn6.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: Tue, 9 May 2023 14:59:53 +0200 Message-ID: <87r0rpacdy.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) 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, 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?1765421616997467887?= X-GMAIL-MSGID: =?utf-8?q?1765421616997467887?= Hi! On 2023-05-09T14:54:21+0200, I wrote: > [...] libgomp testsuite is a bit weird [...]: 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? On top of this I'd then push the attached "libgomp C++, Fortran testsuites: Resolve 'lang_test_file_found' first", see attached, which again is extracted out of my earlier work. This is to enable follow-on clean-up. > 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 9b7c6db76c5757a32b246dc8cb912902a3ffdb35 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sat, 1 Nov 2014 16:25:26 +0100 Subject: [PATCH] libgomp C++, Fortran testsuites: Resolve 'lang_test_file_found' first libgomp/ * testsuite/libgomp.c++/c++.exp: Resolve 'lang_test_file_found' first. * testsuite/libgomp.fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. --- libgomp/testsuite/libgomp.c++/c++.exp | 43 +++++++++---------- libgomp/testsuite/libgomp.fortran/fortran.exp | 30 ++++++------- libgomp/testsuite/libgomp.oacc-c++/c++.exp | 37 ++++++++-------- .../libgomp.oacc-fortran/fortran.exp | 31 +++++++------ 4 files changed, 68 insertions(+), 73 deletions(-) diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index 442e9f744d0..797a05ca870 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -1,12 +1,25 @@ load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp -global shlib_ext - -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 { $blddir != "" } { + set lang_library_path "../libstdc++-v3/src/.libs" + set shlib_ext [get_shlib_extension] + # Look for a static libstdc++ first. + if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { + set lang_test_file_found 1 + # We may have a shared only build, so look for a shared libstdc++. + } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] { + set lang_test_file_found 1 + } else { + puts "No libstdc++ library found, will not execute c++ tests" + } +} elseif { [info exists GXX_UNDER_TEST] } { + set lang_test_file_found 1 +} else { + puts "GXX_UNDER_TEST not defined, will not execute c++ tests" +} +set lang_link_flags "-lstdc++" # If a testcase doesn't have special options, use these. if ![info exists DEFAULT_CFLAGS] then { @@ -24,22 +37,6 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST" set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++" -if { $blddir != "" } { - # Look for a static libstdc++ first. - if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { - set lang_test_file_found 1 - # We may have a shared only build, so look for a shared libstdc++. - } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] { - set lang_test_file_found 1 - } else { - puts "No libstdc++ library found, will not execute c++ tests" - } -} elseif { [info exists GXX_UNDER_TEST] } { - set lang_test_file_found 1 -} else { - puts "GXX_UNDER_TEST not defined, will not execute c++ tests" -} - if { $lang_test_file_found } { # Gather a list of all tests. set tests [lsort [concat \ @@ -72,7 +69,9 @@ if [info exists lang_include_flags] then { unset lang_source_re unset lang_include_flags } -unset lang_library_path +if { $blddir != "" } { + unset lang_library_path +} unset lang_link_flags unset lang_test_file_found diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index 7ea00a25bd9..16ce9d3e023 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -2,23 +2,10 @@ load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp load_gcc_lib gfortran-dg.exp -global shlib_ext -global ALWAYS_CFLAGS - -set shlib_ext [get_shlib_extension] -set lang_library_path "../libgfortran/.libs" -set lang_link_flags "-lgfortran -foffload=-lgfortran" set lang_test_file_found 0 - -# Initialize dg. -dg-init - -# Turn on OpenMP. -lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" - if { $blddir != "" } { - set lang_source_re {^.*\.[fF](|90|95|03|08)$} - set lang_include_flags "-fintrinsic-modules-path=${blddir}" + set lang_library_path "../libgfortran/.libs" + set shlib_ext [get_shlib_extension] # Look for a static libgfortran first. if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] { set lang_test_file_found 1 @@ -33,6 +20,17 @@ if { $blddir != "" } { } else { puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests" } +if { $blddir != "" } { + set lang_source_re {^.*\.[fF](|90|95|03|08)$} + set lang_include_flags "-fintrinsic-modules-path=${blddir}" +} +set lang_link_flags "-lgfortran -foffload=-lgfortran" + +# Initialize dg. +dg-init + +# Turn on OpenMP. +lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $lang_test_file_found } { # Gather a list of all tests. @@ -71,8 +69,8 @@ if { $lang_test_file_found } { if { $blddir != "" } { unset lang_source_re unset lang_include_flags + unset lang_library_path } -unset lang_library_path unset lang_link_flags unset lang_test_file_found diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index 5d9dc5d4a3f..060aaa27419 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -11,26 +11,10 @@ proc check_effective_target_c++ { } { return 1 } -global shlib_ext - -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" - -# Initialize dg. -dg-init -torture-init - -# Turn on OpenACC. -lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" - -# Switch into C++ mode. Otherwise, the libgomp.oacc-c-c++-common/*.c -# files would be compiled as C files. -set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST" -set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++" - if { $blddir != "" } { + set lang_library_path "../libstdc++-v3/src/.libs" + set shlib_ext [get_shlib_extension] # Look for a static libstdc++ first. if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { set lang_test_file_found 1 @@ -45,6 +29,19 @@ if { $blddir != "" } { } else { puts "GXX_UNDER_TEST not defined, will not execute c++ tests" } +set lang_link_flags "-lstdc++" + +# Initialize dg. +dg-init +torture-init + +# Turn on OpenACC. +lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" + +# Switch into C++ mode. Otherwise, the libgomp.oacc-c-c++-common/*.c +# files would be compiled as C files. +set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST" +set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++" if { $lang_test_file_found } { # Gather a list of all tests. @@ -153,7 +150,9 @@ if [info exists lang_include_flags] then { unset lang_source_re unset lang_include_flags } -unset lang_library_path +if { $blddir != "" } { + unset lang_library_path +} unset lang_link_flags unset lang_test_file_found diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index 1ac2320ec22..9af526007cf 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -4,23 +4,10 @@ load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp load_gcc_lib gfortran-dg.exp -global shlib_ext -global ALWAYS_CFLAGS - -set shlib_ext [get_shlib_extension] -set lang_library_path "../libgfortran/.libs" -set lang_link_flags "-lgfortran -foffload=-lgfortran" set lang_test_file_found 0 - -# Initialize dg. -dg-init - -# Turn on OpenACC. -lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" - if { $blddir != "" } { - set lang_source_re {^.*\.[fF](|90|95|03|08)$} - set lang_include_flags "-fintrinsic-modules-path=${blddir}" + set lang_library_path "../libgfortran/.libs" + set shlib_ext [get_shlib_extension] # Look for a static libgfortran first. if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] { set lang_test_file_found 1 @@ -35,6 +22,18 @@ if { $blddir != "" } { } else { puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests" } +if { $blddir != "" } { + set lang_source_re {^.*\.[fF](|90|95|03|08)$} + set lang_include_flags "-fintrinsic-modules-path=${blddir}" +} +set lang_link_flags "-lgfortran -foffload=-lgfortran" + +# Initialize dg. +dg-init + +# Turn on OpenACC. +lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" + if { $lang_test_file_found } { # Gather a list of all tests. @@ -120,8 +119,8 @@ if { $lang_test_file_found } { if { $blddir != "" } { unset lang_source_re unset lang_include_flags + unset lang_library_path } -unset lang_library_path unset lang_link_flags unset lang_test_file_found -- 2.34.1