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
12 func TestMSAN(t
*testing
.T
) {
15 config
:= configure("memory")
16 config
.skipIfCSanitizerBroken(t
)
18 mustRun(t
, config
.goCmd("build", "std"))
26 {src
: "msan2_cmsan.go"},
31 {src
: "msan_fail.go", wantErr
: true},
33 for _
, tc
:= range cases
{
35 name
:= strings
.TrimSuffix(tc
.src
, ".go")
36 t
.Run(name
, func(t
*testing
.T
) {
40 defer dir
.RemoveAll(t
)
42 outPath
:= dir
.Join(name
)
43 mustRun(t
, config
.goCmd("build", "-o", outPath
, srcPath(tc
.src
)))
45 cmd
:= hangProneCmd(outPath
)
47 out
, err
:= cmd
.CombinedOutput()
51 t
.Fatalf("%#q exited without error; want MSAN failure\n%s", strings
.Join(cmd
.Args
, " "), out
)