1
0
mirror of https://github.com/golang/go synced 2024-09-29 07:14:29 -06:00

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>
This commit is contained in:
Austin Clements 2023-05-17 15:32:41 -04:00
parent 408f7a4663
commit ab3c2b6d89
5 changed files with 19 additions and 4 deletions

View File

@ -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;

View File

@ -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

View File

@ -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")
}

View File

@ -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"

View File

@ -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":