From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 518E4385AE51 for ; Thu, 23 Jun 2022 11:28:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 518E4385AE51 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-348-Sr9L2l_vNNiwQzXhhQCDxg-1; Thu, 23 Jun 2022 07:28:19 -0400 X-MC-Unique: Sr9L2l_vNNiwQzXhhQCDxg-1 Received: by mail-ed1-f71.google.com with SMTP id b7-20020a056402350700b00435bd1c4523so2610432edd.5 for ; Thu, 23 Jun 2022 04:28:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QANj6unLBddM56/Uqm56fQegsHOcjOsW2vs1LDvzBUg=; b=GuLQxS+Arik1TFOSlHLDRM9e/9z4NMBr8QhF8y0Zw09I0m1llTSJsIhNv8CisoTadY pXuEROdriSFYkWt5++4hUExesJqrW6ET25VX+GiUhzCB78LrhO/uWxsLviaUdhI3O+2q WuO4aFi8hrCk4kyrqmlJA8qY81V+y2VhwekzLzjgeD+CYFnY4AFrXk6wy8QKMLtbBqeg qrvVquKet3KrrMgFWorl5vSDS9meP3HCqkTEhVnMW9kIc0nVoKh5WNoL4ROqVcpFAKAH ysa+dH6ekR/n1fNaKdLFYQsCkLP+uPGF5QL/MEiBj2HlbKQ/1NTZ55iniE1R8fHxk5qF W9hg== X-Gm-Message-State: AJIora8qxNA6CmQgHWGPK7CQ6T7ZgUQx4szh1aMczYwdioanCYoOeMWS n52QwvCoDJsuObi1980drx1F6cMNRq1bTdgV6ouQpEJs6OvZNyoibklNxnkuOYnzyBoLT1Ygrsg J/dTFyUAdRtTLYokwgUwk3y4sGe69qx4= X-Received: by 2002:a17:907:608b:b0:725:f45:39be with SMTP id ht11-20020a170907608b00b007250f4539bemr2795007ejc.669.1655983698725; Thu, 23 Jun 2022 04:28:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sjI6Fz31oBmQmjiZIjlNL6CIJljwXOLytOB2uIjOOG63phEZEGxtNoy4/OVFGSz/6r+LwBRuYKW1f70CUl0ZY= X-Received: by 2002:a17:907:608b:b0:725:f45:39be with SMTP id ht11-20020a170907608b00b007250f4539bemr2794980ejc.669.1655983698324; Thu, 23 Jun 2022 04:28:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 23 Jun 2022 12:28:07 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: testsuite: test symlnks ifdef _GLIBCXX_HAVE_SYMLINK To: Alexandre Oliva Cc: gcc Patches , "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 11:28:22 -0000 On Thu, 23 Jun 2022 at 12:02, Alexandre Oliva wrote: > > On Jun 22, 2022, Jonathan Wakely wrote: > > > OK. > > > I'd like to clean this up so the tests don't rely on the "internal" > > HAVE_SYMLINK macro. We could add something like this to > > testsuite/util/testsuite_fs.h > > > #if defined(__MINGW32__) || defined(__MINGW64__) \ > > || !defined (_GLIBCXX_HAVE_SYMLINK) > > # define NO_SYMLINKS > > #endif > > I took your suggestion, and took it a little further. Here's the > result. Nice, thanks! > > Regstrapped on x86_64-linux-gnu, also tested with a cross to > aarch64-rtems6. Ok to install? All the changes to the actual tests are fine. > diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp > index 93fdfee687ddb..d71d88fb99837 100644 > --- a/libstdc++-v3/testsuite/lib/libstdc++.exp > +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp > @@ -974,13 +974,16 @@ proc v3_try_preprocess { name code flags } { > } > > # Return 1 if COND evaluates to true in the preprocessor, 0 otherwise. > -# The config header is included. > -proc v3_check_preprocessor_condition { name cond } { > +# The config header is included, and INC, if given, > +# is pasted between it and the condition evaluation, so it can be used > +# for additional #include's. > +proc v3_check_preprocessor_condition { name cond inc } { Could this new arg be given a default value, so every caller doesn't have to pass "" to it? proc v3_check_preprocessor_condition { name cond {inc ""} } { > diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h > index 9358a04e56c1f..048f03103e436 100644 > --- a/libstdc++-v3/testsuite/util/testsuite_fs.h > +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h > @@ -42,6 +42,11 @@ namespace test_fs = std::experimental::filesystem; > #include // std::random_device > #endif > > +#if defined(__MINGW32__) || defined(__MINGW64__) \ > + || !defined (_GLIBCXX_HAVE_SYMLINK) > +#define NO_SYMLINKS > +#endif I think this could be simplified to just #ifndef _GLIBCXX_HAVE_SYMLINK because that is false on mingw: $ grep HAVE_SYMLINK include/x86_64-w64-mingw32/bits/c++config.h /* #undef _GLIBCXX_HAVE_SYMLINK */ Windows uses CreateSymbolicLinkA to create its symlinks. And if NO_SYMLINKS just becomes a "public" name for _GLIBCXX_HAVE_SYMLINK that we can use in tests, then the dg check_v3_target_fs_symlinks proc could just test that macro too, without needing to include to test NO_SYMLINKS. I don't feel strongly about that though. The $inc addition to v3_check_preprocessor_condition seems useful (although it will slow down evaluation of that condition, because includes a lot of other headers). And if the definition of NO_SYMLINKS gets more complicated in future (e.g. we add something like && !defined __foo__) then using NO_SYMLINKS in the dg proc will keep them in sync. I'd like the default argument for v3_check_preprocessor_condition so we don't need to add "" everywhere in that file, but the rest of the patch is OK as-is or simplified as above, I don't mind. Even keeping the MINGW tests in the NO_SYMLINKS definition is OK (it certainly doesn't hurt, it's just a bit redundant).