Commit 61bf0d1c authored by Alex Brainman's avatar Alex Brainman

path/filepath: add test for directory junction walk

For #10424.

Change-Id: Ie4e87503b0ed04f65d2444652bd1db647d3529f4
Reviewed-on: https://go-review.googlesource.com/36851Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 45c6f59e
......@@ -433,3 +433,45 @@ func TestUNC(t *testing.T) {
defer debug.SetMaxStack(debug.SetMaxStack(1e6))
filepath.Glob(`\\?\c:\*`)
}
func TestWalkDirectoryJunction(t *testing.T) {
t.Skip("skipping broken test: see issue 10424")
output, _ := exec.Command("cmd", "/c", "mklink", "/?").Output()
if !strings.Contains(string(output), " /J ") {
t.Skip(`skipping test; mklink does not supports directory junctions`)
}
tmpdir, err := ioutil.TempDir("", "TestWalkDirectoryJunction")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
wd, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
defer os.Chdir(wd)
err = os.Chdir(tmpdir)
if err != nil {
t.Fatal(err)
}
output, err = exec.Command("cmd", "/c", "mklink", "/J", "link", tmpdir).CombinedOutput()
if err != nil {
t.Errorf(`"mklink link %v" command failed: %v\n%v`, tmpdir, err, string(output))
}
walkfunc := func(path string, info os.FileInfo, err error) error {
if err != nil {
t.Log(err)
}
return nil
}
err = filepath.Walk(tmpdir, walkfunc)
if err != nil {
t.Fatal(err)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment