]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mime: remove test ordering dependency
authorIan Lance Taylor <iant@golang.org>
Fri, 7 Apr 2023 20:27:04 +0000 (13:27 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 7 Apr 2023 21:07:10 +0000 (14:07 -0700)
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

gcc/go/gofrontend/MERGE
libgo/go/mime/type_test.go
libgo/go/mime/type_unix_test.go

index addef6f8f5153c498b215adcc058b40c9e4d73da..e133650ad915176d71df790b6a0af6314c8eda09 100644 (file)
@@ -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.
index 5e4d25cc872a508e0949392aa8bf440348e9769e..5769c6a55de294d6405c767785049ae604109d28 100644 (file)
@@ -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() {
index 4d109aa71a228eb1124900ad22242bdf9d06c303..43db44b7aa137bd2effcc5e15aede7b413650b64 100644 (file)
@@ -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)