diff options
author | Bryan C. Mills <bcmills@google.com> | 2019-11-15 13:13:16 -0500 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2019-11-15 20:56:35 +0000 |
commit | 9af8794353d2c19621c0264f9a3f78d671fc86ef (patch) | |
tree | ca98b2543190711eb7bdbb322966ad3dea81e7f0 /test/sinit_run.go | |
parent | e1fa96049358737b138425918ce8d4a1f25ffd70 (diff) | |
download | go-9af8794353d2c19621c0264f9a3f78d671fc86ef.tar.gz go-9af8794353d2c19621c0264f9a3f78d671fc86ef.zip |
test: avoid writing temporary files to GOROOT
Updates #28387
Fixes #35619
Change-Id: I162f3427b7901c117e3f3e403df7edec7c529bd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/207352
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/sinit_run.go')
-rw-r--r-- | test/sinit_run.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/sinit_run.go b/test/sinit_run.go index fdd19c492f..afd15ffbf2 100644 --- a/test/sinit_run.go +++ b/test/sinit_run.go @@ -17,15 +17,18 @@ import ( ) func main() { - cmd := exec.Command("go", "tool", "compile", "-S", "sinit.go") + cmd := exec.Command("go", "tool", "compile", "-o", os.DevNull, "-S", "sinit.go") out, err := cmd.CombinedOutput() if err != nil { fmt.Println(string(out)) fmt.Println(err) os.Exit(1) } - os.Remove("sinit.o") + if len(bytes.TrimSpace(out)) == 0 { + fmt.Println("'go tool compile -S sinit.go' printed no output") + os.Exit(1) + } if bytes.Contains(out, []byte("initdone")) { fmt.Println("sinit generated an init function") os.Exit(1) |