From patchwork Tue Sep 12 13:39:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 138190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp415312vqx; Tue, 12 Sep 2023 06:41:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZNjToz+V5LcyduZOEukaODlhG5IuUa6gf8+T9suWRZf9eXlrlPp063s1v9uyTVHpfLalY X-Received: by 2002:a05:6512:b9f:b0:500:9dd4:2969 with SMTP id b31-20020a0565120b9f00b005009dd42969mr11996161lfv.59.1694526105752; Tue, 12 Sep 2023 06:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694526105; cv=none; d=google.com; s=arc-20160816; b=LRhRZntZWGQUPyHklwTmw1Gb861BhVLRt0B7u8w+nvMOTQgJKKXkx8j9tg5BWy6NVk U9dlxIWvMdYSee8uJnZ/QYQmMFY+dfW6f02ZujfU3obW2tpYVuoVX9eiWp5t6farm2L7 tGC2RvF0Zx+CRT53IfCDAd6w1DE2unI1UpegWPSoQecZ4xgag7vpmd/zC34ht4KgdXQ8 JtWmtIhYsxkTxHmPn08D+ODkOVtCw+og9AmUzj5b7U1QTRKK2Lwr/GDBQpEa1YYrye6j kIllZg3WMPlVDa/eYdvd40zZgRxeQ7Wq30+y8hSc4h7nKsYg8mKqrCfrUTObPURiqz8f hUgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=MwMhXHpHskplINBo4kJa6c4v1AirTay2ggflPKVPZjg=; fh=sJ+2/4g29YdyXkoRrFZSpsL2zxijepB7X/1rB0LDDh8=; b=lgtjYskuANL5OL4b/1C74pHPdO5bIltSdMkQ3bLYWCh34zysGBdhhoQw5259JcGX18 iENBwDA5r/FhOK+v1Jter7yRoWskrdGZpn/MuTdwblG1SNYY7Fz20qOWWRRDjG2M+EJ7 wahr2XB9oyLhc8PxUfjaUhTVDmG2PW7PyoNAxIXFG0FQk66sLqu/pAM1cjNh28uCwdJ9 6DCMaPgmL08zlWurNPkONV0cLucwbHOkBlBXcx7yjWtzhdCaO8XDHdiKHVvzgE2hRqee cpLNM+WG1vilWAJqCdHZ0XX1IJpT+tItLGY14ze7P6ylW24HtE0UoHMOJh8W+EFiW/3f a1Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=dpL4PXHn; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id cw13-20020a170906c78d00b00992d0de875dsi8270792ejb.912.2023.09.12.06.41.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 06:41:45 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=dpL4PXHn; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C15463858028 for ; Tue, 12 Sep 2023 13:41:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C15463858028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694526089; bh=MwMhXHpHskplINBo4kJa6c4v1AirTay2ggflPKVPZjg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dpL4PXHnFKweiY+u2PrRsee6M68ALCiFEv9I7gxUlR6tAqlCKJSF0+uis8IvBEN9y OsESvWRPr/BORrXAmmM7rD2+kNPCf16JpyPPjP2a49jAfWjxfE98UkRjRH2IJ3yXdQ xD+ZGKWo8ngT6q35wLBjwnaHedhurssVrUrl4HuQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 BAFFF3858D3C for ; Tue, 12 Sep 2023 13:40:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAFFF3858D3C Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-421-ThMpx8iGOjCJNMuiMn2JOw-1; Tue, 12 Sep 2023 09:40:45 -0400 X-MC-Unique: ThMpx8iGOjCJNMuiMn2JOw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB5C28C3927; Tue, 12 Sep 2023 13:40:44 +0000 (UTC) Received: from localhost (unknown [10.42.28.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C1907B62; Tue, 12 Sep 2023 13:40:44 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 14/13] libstdc++: Re-initialize static data files used by tests Date: Tue, 12 Sep 2023 14:39:52 +0100 Message-ID: <20230912134044.1993413-1-jwakely@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776839406230102703 X-GMAIL-MSGID: 1776839406230102703 This fixes the problem observed with some filebuf tests. The "@require@" string seems a bit hacky, as I don't know why that string is in the tests in the first palce ... but it is there, so this works. -- > 8-- Some tests rely on text files with specific content being present in the test directory. Because the tests modify those files, running the same test more than once in the same directory will FAIL because the content of the file is not in the expected state. This uses a "@require@" marker that happens to be present in those tests to decide when we need to copy the original files into the test dir again, so that repeated tests always see the initial file content. libstdc++-v3/ChangeLog: * testsuite/lib/libstdc++.exp (v3-init-data-files): New proc. (libstdc++_init): Use v3-init-data-files. (v3-dg-runtest): Use v3-init-data-files to update test data files for repeated tests. --- libstdc++-v3/testsuite/lib/libstdc++.exp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 2c497707184..daace4c1d59 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -102,6 +102,12 @@ proc v3-copy-files {srcfiles} { } } +proc v3-init-data-files { } { + global srcdir + v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"] + v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"] +} + # Called once, during runtest.exp setup. proc libstdc++_init { testfile } { global env @@ -159,8 +165,7 @@ proc libstdc++_init { testfile } { set dg-do-what-default run # Copy any required data files. - v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"] - v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"] + v3-init-data-files set ld_library_path_tmp "" @@ -556,11 +561,26 @@ proc v3-dg-runtest { testcases flags default-extra-flags } { set option_list { "" } } + # Some tests (e.g. 27_io/basic_filebuf/seek{off,pos}/char/[12]-io.cc) + # rely on text files with specific data being present in the test dir. + # Because the tests modify those files, running the same test a second + # time will FAIL due to the files not being in their initial state. + # We rely on the fact that those files contain a "@require@" comment + # to trigger creating fresh copies of the files for repeated tests. + if [search_for $test "@require@"] { + set need_fresh_data_files [llength $option_list] + } else { + set need_fresh_data_files 0 + } + set nshort [file tail [file dirname $test]]/[file tail $test] foreach flags_t $option_list { verbose "Testing $nshort, $flags $flags_t" 1 dg-test $test "$flags $flags_t" ${default-extra-flags} + if { $need_fresh_data_files > 1 } { + v3-init-data-files + } } } }