PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgo / misc / cgo / testsanitizers / tsan_test.go
blobec4e0033fb43a4bef1c8f39782e9d8397739325e
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 "strings"
9 "testing"
12 func TestTSAN(t *testing.T) {
13 t.Parallel()
14 requireOvercommit(t)
15 config := configure("thread")
16 config.skipIfCSanitizerBroken(t)
18 mustRun(t, config.goCmd("build", "std"))
20 cases := []struct {
21 src string
22 needsRuntime bool
24 {src: "tsan.go"},
25 {src: "tsan2.go"},
26 {src: "tsan3.go"},
27 {src: "tsan4.go"},
28 {src: "tsan5.go", needsRuntime: true},
29 {src: "tsan6.go", needsRuntime: true},
30 {src: "tsan7.go", needsRuntime: true},
31 {src: "tsan8.go"},
32 {src: "tsan9.go"},
33 {src: "tsan10.go", needsRuntime: true},
34 {src: "tsan11.go", needsRuntime: true},
35 {src: "tsan12.go", needsRuntime: true},
37 for _, tc := range cases {
38 tc := tc
39 name := strings.TrimSuffix(tc.src, ".go")
40 t.Run(name, func(t *testing.T) {
41 t.Parallel()
43 dir := newTempDir(t)
44 defer dir.RemoveAll(t)
46 outPath := dir.Join(name)
47 mustRun(t, config.goCmd("build", "-o", outPath, srcPath(tc.src)))
49 cmd := hangProneCmd(outPath)
50 if tc.needsRuntime {
51 config.skipIfRuntimeIncompatible(t)
53 mustRun(t, cmd)