]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: delete temporary files when test finishes
authorMichael Munday <mike.munday@ibm.com>
Fri, 17 Nov 2017 10:01:06 +0000 (10:01 +0000)
committerMichael Munday <mike.munday@ibm.com>
Fri, 17 Nov 2017 21:35:43 +0000 (21:35 +0000)
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/78475
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

src/cmd/compile/internal/gc/ssa_test.go

index 03d6f4218f24c3ebd5c91fb6d0d5f38430e76e69..28670542e7a1260569d069f06bd2e053ee9de16a 100644 (file)
@@ -8,6 +8,7 @@ import (
        "bytes"
        "internal/testenv"
        "io/ioutil"
+       "os"
        "os/exec"
        "path/filepath"
        "runtime"
@@ -64,6 +65,7 @@ func runGenTest(t *testing.T, filename, tmpname string, ev ...string) {
        if ok != nil {
                t.Fatalf("Failed to create temporary directory")
        }
+       defer os.RemoveAll(tmpdir)
 
        rungo := filepath.Join(tmpdir, "run.go")
        ok = ioutil.WriteFile(rungo, stdout.Bytes(), 0600)