runtime/race: add end-to-end test

Fixes #5933.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12699051
This commit is contained in:
Dmitriy Vyukov 2013-08-12 22:04:10 +04:00
parent fa4628346b
commit 2791ef0b67
3 changed files with 115 additions and 3 deletions

View file

@ -44,14 +44,16 @@ func executeTest(t *testing.T, templ string, data interface{}) string {
src := filepath.Join(dir, "main.go")
f, err := os.Create(src)
if err != nil {
t.Fatalf("failed to create %v: %v", src, err)
t.Fatalf("failed to create file: %v", err)
}
err = st.Execute(f, data)
if err != nil {
f.Close()
t.Fatalf("failed to execute template: %v", err)
}
f.Close()
if err := f.Close(); err != nil {
t.Fatalf("failed to close file: %v", err)
}
got, _ := testEnv(exec.Command("go", "run", src)).CombinedOutput()
return string(got)