Commit 3e59b20d authored by Hiroshi Ioka's avatar Hiroshi Ioka Committed by Alex Brainman

os: fix build error on plan9

https://go-review.googlesource.com/#/c/27580 added the test.
However the test use syscall.ELOOP which is not defined on plan9.
Move test code from "os_test.go" to "os_windows_test.go" to prevent
build error.

Change-Id: Ie7f05bfb9ab229e06a8e82a4b3b8a7ca82d4663b
Reviewed-on: https://go-review.googlesource.com/27833
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDavid du Colombier <0intro@gmail.com>
Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
parent a656390b
......@@ -1812,26 +1812,3 @@ func TestRemoveAllRace(t *testing.T) {
close(hold) // let workers race to remove root
wg.Wait()
}
func TestStatSymlinkLoop(t *testing.T) {
testenv.MustHaveSymlink(t)
defer chtmpdir(t)()
err := Symlink("x", "y")
if err != nil {
t.Fatal(err)
}
defer Remove("y")
err = Symlink("y", "x")
if err != nil {
t.Fatal(err)
}
defer Remove("x")
_, err = Stat("x")
if perr, ok := err.(*PathError); !ok || perr.Err != syscall.ELOOP {
t.Errorf("expected *PathError with ELOOP, got %T: %v\n", err, err)
}
}
......@@ -5,6 +5,7 @@
package os_test
import (
"internal/testenv"
"io/ioutil"
"os"
osexec "os/exec"
......@@ -229,3 +230,26 @@ func TestDeleteReadOnly(t *testing.T) {
t.Fatal(err)
}
}
func TestStatSymlinkLoop(t *testing.T) {
testenv.MustHaveSymlink(t)
defer chtmpdir(t)()
err := os.Symlink("x", "y")
if err != nil {
t.Fatal(err)
}
defer os.Remove("y")
err = os.Symlink("y", "x")
if err != nil {
t.Fatal(err)
}
defer os.Remove("x")
_, err = os.Stat("x")
if perr, ok := err.(*os.PathError); !ok || perr.Err != syscall.ELOOP {
t.Errorf("expected *PathError with ELOOP, got %T: %v\n", err, 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