libgo: update to Go 1.11
[official-gcc.git] / libgo / misc / cgo / testsanitizers / tsan_test.go
blob1d769a98b6e26c7c50473ad8373da45db92d22b5
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package sanitizers_test
7 import (
8 "runtime"
9 "strings"
10 "testing"
13 func TestTSAN(t *testing.T) {
14 if runtime.GOARCH == "arm64" {
15 t.Skip("skipping test; see https://golang.org/issue/25682")
17 t.Parallel()
18 requireOvercommit(t)
19 config := configure("thread")
20 config.skipIfCSanitizerBroken(t)
22 mustRun(t, config.goCmd("build", "std"))
24 cases := []struct {
25 src string
26 needsRuntime bool
28 {src: "tsan.go"},
29 {src: "tsan2.go"},
30 {src: "tsan3.go"},
31 {src: "tsan4.go"},
32 {src: "tsan5.go", needsRuntime: true},
33 {src: "tsan6.go", needsRuntime: true},
34 {src: "tsan7.go", needsRuntime: true},
35 {src: "tsan8.go"},
36 {src: "tsan9.go"},
37 {src: "tsan10.go", needsRuntime: true},
38 {src: "tsan11.go", needsRuntime: true},
39 {src: "tsan12.go", needsRuntime: true},
41 for _, tc := range cases {
42 tc := tc
43 name := strings.TrimSuffix(tc.src, ".go")
44 t.Run(name, func(t *testing.T) {
45 t.Parallel()
47 dir := newTempDir(t)
48 defer dir.RemoveAll(t)
50 outPath := dir.Join(name)
51 mustRun(t, config.goCmd("build", "-o", outPath, srcPath(tc.src)))
53 cmd := hangProneCmd(outPath)
54 if tc.needsRuntime {
55 config.skipIfRuntimeIncompatible(t)
57 mustRun(t, cmd)