diff options
author | Austin Clements <austin@google.com> | 2023-05-17 15:32:41 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2023-05-19 01:37:35 +0000 |
commit | ab3c2b6d89daa54679cdaa0d78d2902473e0d63b (patch) | |
tree | 61940c3a0924ec6993be45165b3309bdc949bb97 /src/cmd | |
parent | 408f7a4663fdb19357e2c0967eb442a1e5679b2d (diff) | |
download | go-ab3c2b6d89daa54679cdaa0d78d2902473e0d63b.tar.gz go-ab3c2b6d89daa54679cdaa0d78d2902473e0d63b.zip |
cmd/cgo/internal/testtls: build and run everywhere
This makes testtls build and run on all platforms in the default build
configuration (though it will Skip on some).
Change-Id: I6aba96a82d618c9798a0d4418b40b2644cfceec9
Reviewed-on: https://go-review.googlesource.com/c/go/+/496177
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/cgo/internal/testtls/tls.c (renamed from src/cmd/cgo/internal/testtls/tls_unix.c) | 4 | ||||
-rw-r--r-- | src/cmd/cgo/internal/testtls/tls.go | 2 | ||||
-rw-r--r-- | src/cmd/cgo/internal/testtls/tls_none.go | 13 | ||||
-rw-r--r-- | src/cmd/cgo/internal/testtls/tls_test.go | 2 | ||||
-rw-r--r-- | src/cmd/dist/test.go | 2 |
5 files changed, 19 insertions, 4 deletions
diff --git a/src/cmd/cgo/internal/testtls/tls_unix.c b/src/cmd/cgo/internal/testtls/tls.c index 957afce90d..0e2bbee542 100644 --- a/src/cmd/cgo/internal/testtls/tls_unix.c +++ b/src/cmd/cgo/internal/testtls/tls.c @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// Darwin does not have __thread. + +//go:build cgo && unix && !darwin + #include <pthread.h> static __thread int tls; diff --git a/src/cmd/cgo/internal/testtls/tls.go b/src/cmd/cgo/internal/testtls/tls.go index 4684f82ebd..eb59ad41eb 100644 --- a/src/cmd/cgo/internal/testtls/tls.go +++ b/src/cmd/cgo/internal/testtls/tls.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build unix +//go:build cgo && unix && !darwin package cgotlstest diff --git a/src/cmd/cgo/internal/testtls/tls_none.go b/src/cmd/cgo/internal/testtls/tls_none.go new file mode 100644 index 0000000000..81c9c5e23d --- /dev/null +++ b/src/cmd/cgo/internal/testtls/tls_none.go @@ -0,0 +1,13 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !(cgo && unix && !darwin) + +package cgotlstest + +import "testing" + +func testTLS(t *testing.T) { + t.Skip("__thread is not supported") +} diff --git a/src/cmd/cgo/internal/testtls/tls_test.go b/src/cmd/cgo/internal/testtls/tls_test.go index 10b71f074e..8e14add988 100644 --- a/src/cmd/cgo/internal/testtls/tls_test.go +++ b/src/cmd/cgo/internal/testtls/tls_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build cgo && unix - package cgotlstest import "testing" diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index fe818036b5..40df8c03b8 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -1129,6 +1129,7 @@ func (t *tester) registerCgoTests(heading string) { } cgoTest("auto", "test", "auto", "") + cgoTest("auto", "testtls", "auto", "") // Stub out various buildmode=pie tests on alpine until 54354 resolved. builderName := os.Getenv("GO_BUILDER_NAME") @@ -1162,7 +1163,6 @@ func (t *tester) registerCgoTests(heading string) { gt := cgoTest("external-g0", "test", "external", "") gt.env = append(gt.env, "CGO_CFLAGS=-g0 -fdiagnostics-color") - cgoTest("auto", "testtls", "auto", "") cgoTest("external", "testtls", "external", "") switch { case os == "aix": |