mirror of
https://github.com/golang/go
synced 2024-11-26 16:16:57 -07:00
os: avoid TestFileChdir fail when GOROOT is a symbolic link
If GOROOT is a symbolic link, the paths obtained from the first and second Getwd of TestFileChdir are different, and this CL fixes the test failure in this situation.
This commit is contained in:
parent
841e63e480
commit
5cc418e625
@ -1620,8 +1620,17 @@ func TestFileChdir(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Getwd: %s", err)
|
||||
}
|
||||
if !equal(wdNew, wd) {
|
||||
t.Fatalf("fd.Chdir failed, got %s, want %s", wdNew, wd)
|
||||
|
||||
wdInfo, err := fd.Stat()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
newInfo, err := Stat(wdNew)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !SameFile(wdInfo, newInfo) {
|
||||
t.Fatalf("fd.Chdir failed: got %s, want %s", wdNew, wd)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user