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 9961C3858C50 for ; Tue, 12 Sep 2023 13:40:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9961C3858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694526048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MwMhXHpHskplINBo4kJa6c4v1AirTay2ggflPKVPZjg=; b=KzSJFiAZdzi7RTdtm/yWaDs1aZe/+YXBaYMsylOFzaYuqXe3UDJKaQOMuQ8+gXCzkEqNRv PirAIe4xy2+3Ofz99bnt0425Tk8w0H2KMqvA3c1ZSw4XMaa91dGUu+iJmTBNVK1SI5wPTo dn3dKe4d9ZryhMPW3P9e3ybRSeL0JVw= 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) From: Jonathan Wakely 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 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 + } } } } -- 2.41.0