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.129.124]) by sourceware.org (Postfix) with ESMTPS id D103C3856260 for ; Thu, 23 Jun 2022 11:29:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D103C3856260 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-PgWwLdOuPjW0d1mUjjtL3w-1; Thu, 23 Jun 2022 07:29:50 -0400 X-MC-Unique: PgWwLdOuPjW0d1mUjjtL3w-1 Received: by mail-ed1-f72.google.com with SMTP id w22-20020a05640234d600b00435ba41dbaaso3013345edc.12 for ; Thu, 23 Jun 2022 04:29:50 -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=AHov+N/4lma8auXYmff3AtQ5ta3NglFXzM7I6MfJHts=; b=rskZ+bgk4+idfp71SsH6sywfNOL8d/zVLyVpnoYhgMP/igmOPUWZp7K99KKSMo/hv+ mTcDlw4dpdF6PUGE6SFPEYKQGwRE3O+qwE6JyPJAizmjM6QhLGbeGwknrRc0xOaCv7B0 Pi19XcwJ9JnYKHUH3TpqpGIty3U2i4hwBxD+qYwUW+8HPyfCPfjwMUU7dj/6Expr7gxL CWDxHyaa9dxslzSvgTe6fgU8gfrn/8ZmkdJsRkgauvX/KBVb/1IBq80IrL8s/XTB9fgI 6Y8LXUHbedJ6zbczPwj8+M22Rj39uXRntb6ANNzHL2WjOPwFS9B1RkGK1apHbLikPM5D e7Pw== X-Gm-Message-State: AJIora8VtPe9CxjCtWyDgR7uqHFJLs+bFjnIOu4QkIFZV+3eKSrKZzcW Im5cHvxChHgNX9DJieMqyTCWxvMhNj5frPxC0keUDHjjYymxInvlZYMYEpSEXFUuxdOJ7u1zGyK f+P8PLxRExpEE4ddRyiz1jw/UrLijgJA= X-Received: by 2002:a17:906:8301:b0:6e4:896d:59b1 with SMTP id j1-20020a170906830100b006e4896d59b1mr7454435ejx.396.1655983789272; Thu, 23 Jun 2022 04:29:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sS56MaOkTzTeIT+s3U9PAyawEAr0liZjsy35kRvzdK3bAzAMN0N7uX0cpY9I0UD1T7Ej9qp37FvclzsbJNiA4= X-Received: by 2002:a17:906:8301:b0:6e4:896d:59b1 with SMTP id j1-20020a170906830100b006e4896d59b1mr7454415ejx.396.1655983789048; Thu, 23 Jun 2022 04:29:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 23 Jun 2022 12:29:38 +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=-14.7 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:29:53 -0000 On Thu, 23 Jun 2022 at 12:28, Jonathan Wakely wrote: > > 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. Oh, and we need to be able to include for the similar NO_SPACE macro in your next patch, so we might as well check NO_SYMLINKS the same way. > 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).