re PR go/89406 (Go testing leaves many temporary directories in /tmp around)

PR go/89406
    net: remove unixgram test sockets
    
    Backport https://golang.org/cl/163277 from the master library.
    
    Updates https://gcc.gnu.org/PR89406
    
    Reviewed-on: https://go-review.googlesource.com/c/163200

From-SVN: r269087
This commit is contained in:
Ian Lance Taylor 2019-02-22 00:47:30 +00:00
parent 8aef6e02ad
commit f08e60e988
4 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
4fbd06dc7b1b8fb665293399a2b6d5326435512f 45a2e231958854fd945961f0335ac0805d502510
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.

View File

@ -780,6 +780,9 @@ func TestListenConfigControl(t *testing.T) {
continue continue
} }
c.Close() c.Close()
if network == "unixgram" {
os.Remove(address)
}
} }
}) })
} }

View File

@ -17,8 +17,6 @@ import (
) )
// testUnixAddr uses ioutil.TempFile to get a name that is unique. // testUnixAddr uses ioutil.TempFile to get a name that is unique.
// It also uses /tmp directory in case it is prohibited to create UNIX
// sockets in TMPDIR.
func testUnixAddr() string { func testUnixAddr() string {
f, err := ioutil.TempFile("", "go-nettest") f, err := ioutil.TempFile("", "go-nettest")
if err != nil { if err != nil {

View File

@ -242,6 +242,7 @@ func testSpliceNoUnixgram(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer os.Remove(addr.Name)
up, err := ListenUnixgram("unixgram", addr) up, err := ListenUnixgram("unixgram", addr)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)