mirror of
https://github.com/golang/go
synced 2024-11-22 23:50:03 -07:00
os: make TestMkdirAllWithSymlink more robust
Don't assume the test has a clean environment within /tmp. Use an actual new tempdir for its tests. Fixes FreeBSD build failure as seen at: http://build.golang.org/log/396738676356d7fb6bab6eaf1b97cac820f8a90f --- FAIL: TestMkdirAllWithSymlink (0.00 seconds) path_test.go:178: Mkdir /tmp/dir: mkdir /tmp/dir: file exists FAIL FAIL os 1.091s R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/6615057
This commit is contained in:
parent
13576e3b65
commit
54c109b122
@ -5,6 +5,7 @@
|
||||
package os_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
. "os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@ -171,20 +172,23 @@ func TestMkdirAllWithSymlink(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
tmpDir := TempDir()
|
||||
tmpDir, err := ioutil.TempDir("", "TestMkdirAllWithSymlink-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer RemoveAll(tmpDir)
|
||||
|
||||
dir := tmpDir + "/dir"
|
||||
err := Mkdir(dir, 0755)
|
||||
err = Mkdir(dir, 0755)
|
||||
if err != nil {
|
||||
t.Fatalf("Mkdir %s: %s", dir, err)
|
||||
}
|
||||
defer RemoveAll(dir)
|
||||
|
||||
link := tmpDir + "/link"
|
||||
err = Symlink("dir", link)
|
||||
if err != nil {
|
||||
t.Fatalf("Symlink %s: %s", link, err)
|
||||
}
|
||||
defer RemoveAll(link)
|
||||
|
||||
path := link + "/foo"
|
||||
err = MkdirAll(path, 0755)
|
||||
|
Loading…
Reference in New Issue
Block a user