diff options
| author | Alex Brainman <alex.brainman@gmail.com> | 2017-02-12 18:23:34 +1100 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2017-02-12 23:33:01 +0000 |
| commit | 61bf0d1c4033ef2cc6905c2ca6e03046cf54d2bc (patch) | |
| tree | 4b9ea38c4b761842ad866c3e02f20e0001ce96f8 /src/path | |
| parent | 45c6f59e1fd94ccb11fde61ca8d5b33b3d06dd9f (diff) | |
| download | go-61bf0d1c4033ef2cc6905c2ca6e03046cf54d2bc.tar.xz | |
path/filepath: add test for directory junction walk
For #10424.
Change-Id: Ie4e87503b0ed04f65d2444652bd1db647d3529f4
Reviewed-on: https://go-review.googlesource.com/36851
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/path')
| -rw-r--r-- | src/path/filepath/path_windows_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go index c9a0255efd..795b1f1bb8 100644 --- a/src/path/filepath/path_windows_test.go +++ b/src/path/filepath/path_windows_test.go @@ -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) + } +} |
