aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-04-07 13:27:04 -0700
committerIan Lance Taylor <iant@golang.org>2023-04-07 14:07:10 -0700
commitf22c12d7361d22d47cce73d342edf2e1ebf20520 (patch)
treeebd8e7630e3d9ed37c26d2620b66925b61837ac3 /libgo
parentf189c4ab489ce72e949c1ecde6b97e9dcbddf72e (diff)
downloadgcc-f22c12d7361d22d47cce73d342edf2e1ebf20520.zip
gcc-f22c12d7361d22d47cce73d342edf2e1ebf20520.tar.gz
gcc-f22c12d7361d22d47cce73d342edf2e1ebf20520.tar.bz2
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
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/mime/type_test.go5
-rw-r--r--libgo/go/mime/type_unix_test.go1
2 files changed, 5 insertions, 1 deletions
diff --git a/libgo/go/mime/type_test.go b/libgo/go/mime/type_test.go
index 5e4d25c..5769c6a 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 4d109aa..43db44b 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)