From 64ef1e96ff72cbf856d1fc8c2eb6e78afd94d86a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 2 Mar 2019 00:50:30 +0000 Subject: [PATCH] re PR go/89406 (Go testing leaves many temporary directories in /tmp around) 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 | 2 +- libgo/go/go/internal/gccgoimporter/importer_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 62ce2015df7..49ebe3260c2 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/libgo/go/go/internal/gccgoimporter/importer_test.go b/libgo/go/go/internal/gccgoimporter/importer_test.go index 7a21c5f2f48..58fa8c8cf5c 100644 --- a/libgo/go/go/internal/gccgoimporter/importer_test.go +++ b/libgo/go/go/internal/gccgoimporter/importer_test.go @@ -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) - } } -- 2.30.2