public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7118] mime: remove test ordering dependency
@ 2023-04-07 21:07 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2023-04-07 21:07 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f22c12d7361d22d47cce73d342edf2e1ebf20520

commit r13-7118-gf22c12d7361d22d47cce73d342edf2e1ebf20520
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Apr 7 13:27:04 2023 -0700

    mime: remove test ordering dependency
    
    Backport CL 421442 from upstream.
    
    Original description:
    
    Arrange for tests that call setMimeInit to fully restore the old values,
    by clearing the sync.Once that controls initialization.
    
    Once we've done that, call initMime in initMimeUnixTest because
    otherwise the test types loaded there will be cleared by the call to
    initMime that previously was not being done.
    
    For golang/go#51648
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/483117

Diff:
---
 gcc/go/gofrontend/MERGE         | 2 +-
 libgo/go/mime/type_test.go      | 5 ++++-
 libgo/go/mime/type_unix_test.go | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index addef6f8f51..e133650ad91 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-63ba7dd52f2cc49dab4b70ac81309296a920d4dc
+0411a2733fd468e69f1998edd91e8fe3ba40ff9e
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/mime/type_test.go b/libgo/go/mime/type_test.go
index 5e4d25cc872..5769c6a55de 100644
--- a/libgo/go/mime/type_test.go
+++ b/libgo/go/mime/type_test.go
@@ -14,7 +14,10 @@ import (
 func setMimeInit(fn func()) (cleanup func()) {
 	once = sync.Once{}
 	testInitMime = fn
-	return func() { testInitMime = nil }
+	return func() {
+		testInitMime = nil
+		once = sync.Once{}
+	}
 }
 
 func clearMimeTypes() {
diff --git a/libgo/go/mime/type_unix_test.go b/libgo/go/mime/type_unix_test.go
index 4d109aa71a2..43db44b7aa1 100644
--- a/libgo/go/mime/type_unix_test.go
+++ b/libgo/go/mime/type_unix_test.go
@@ -11,6 +11,7 @@ import (
 )
 
 func initMimeUnixTest(t *testing.T) {
+	once.Do(initMime)
 	err := loadMimeGlobsFile("testdata/test.types.globs2")
 	if err != nil {
 		t.Fatal(err)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-07 21:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07 21:07 [gcc r13-7118] mime: remove test ordering dependency Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).