re PR go/89406 (Go testing leaves many temporary directories in /tmp around)
authorIan Lance Taylor <ian@gcc.gnu.org>
Sat, 2 Mar 2019 00:50:30 +0000 (00:50 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sat, 2 Mar 2019 00:50:30 +0000 (00:50 +0000)
PR go/89406
    go/internal/gccgoimporter: remove temporary directories in test

    Backport of https://golang.org/cl/164862.

    Updates https://gcc.gnu.org/PR89406

    Reviewed-on: https://go-review.googlesource.com/c/164863

From-SVN: r269338

gcc/go/gofrontend/MERGE
libgo/go/go/internal/gccgoimporter/importer_test.go

index 62ce2015df731dc26e934d69b4e99c73d3c5a692..49ebe3260c242aca4796bc4485d30755f359cdf5 100644 (file)
@@ -1,4 +1,4 @@
-a72eca1f435002076655fd6a54ce869ac39856dc
+decbbfb563ecf4609a3148dc789ae77ab1c62768
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 7a21c5f2f484654f08c7eb72ed71d2b9eaca7862..58fa8c8cf5ccad8aeede19bc01e18c19b886ec31 100644 (file)
@@ -143,17 +143,21 @@ func TestObjImporter(t *testing.T) {
        }
        t.Logf("gccgo version %d.%d", major, minor)
 
-       tmpdir, err := ioutil.TempDir("", "")
+       tmpdir, err := ioutil.TempDir("", "TestObjImporter")
        if err != nil {
                t.Fatal(err)
        }
+       defer os.RemoveAll(tmpdir)
+
        initmap := make(map[*types.Package]InitData)
        imp := GetImporter([]string{tmpdir}, initmap)
 
-       artmpdir, err := ioutil.TempDir("", "")
+       artmpdir, err := ioutil.TempDir("", "TestObjImporter")
        if err != nil {
                t.Fatal(err)
        }
+       defer os.RemoveAll(artmpdir)
+
        arinitmap := make(map[*types.Package]InitData)
        arimp := GetImporter([]string{artmpdir}, arinitmap)
 
@@ -198,8 +202,4 @@ func TestObjImporter(t *testing.T) {
                        t.Fatal(err)
                }
        }
-
-       if err = os.Remove(tmpdir); err != nil {
-               t.Fatal(err)
-       }
 }