Commit 644787c3 authored by Michael Munday's avatar Michael Munday

cmd/compile: delete temporary files when test finishes

I noticed some files prefixed with ssa_fg_tmp in the /tmp folder of
the s390x builder. runGenTest (a helper for TestGenFlowGraph) wasn't
deleting its temporary files. The distinct prefix made this easy to
figure out.

Change-Id: If0d608aaad04a414e74e29f027ec9443c626e4eb
Reviewed-on: https://go-review.googlesource.com/78475Reviewed-by: default avatarDavid Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
parent 4e19cfcd
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"bytes" "bytes"
"internal/testenv" "internal/testenv"
"io/ioutil" "io/ioutil"
"os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
...@@ -64,6 +65,7 @@ func runGenTest(t *testing.T, filename, tmpname string, ev ...string) { ...@@ -64,6 +65,7 @@ func runGenTest(t *testing.T, filename, tmpname string, ev ...string) {
if ok != nil { if ok != nil {
t.Fatalf("Failed to create temporary directory") t.Fatalf("Failed to create temporary directory")
} }
defer os.RemoveAll(tmpdir)
rungo := filepath.Join(tmpdir, "run.go") rungo := filepath.Join(tmpdir, "run.go")
ok = ioutil.WriteFile(rungo, stdout.Bytes(), 0600) ok = ioutil.WriteFile(rungo, stdout.Bytes(), 0600)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment