Commit 3cbe7ea7 authored by Mikio Hara's avatar Mikio Hara Committed by David Crawshaw

os: fix TestProgWideChdir on darwin

On darwin, /tmp and /var directories are usually linked to /private.

% cd $TMPDIR; pwd -L
/var/.../T
% pwd -P
/private/var/.../T

Change-Id: I277ff2d096344d9a80e6004a83e9fc3e1716348c
Reviewed-on: https://go-review.googlesource.com/8842Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
parent d1eee2ce
...@@ -1060,7 +1060,8 @@ func TestProgWideChdir(t *testing.T) { ...@@ -1060,7 +1060,8 @@ func TestProgWideChdir(t *testing.T) {
<-c <-c
pwd, err := Getwd() pwd, err := Getwd()
if err != nil { if err != nil {
t.Fatal("Getwd: %v", err) t.Errorf("Getwd on goroutine %d: %v", i, err)
return
} }
cpwd <- pwd cpwd <- pwd
}(i) }(i)
...@@ -1082,11 +1083,17 @@ func TestProgWideChdir(t *testing.T) { ...@@ -1082,11 +1083,17 @@ func TestProgWideChdir(t *testing.T) {
if err := Chdir(d); err != nil { if err := Chdir(d); err != nil {
t.Fatal("Chdir: %v", err) t.Fatal("Chdir: %v", err)
} }
// OS X sets TMPDIR to a symbolic link.
// So we resolve our working directory again before the test.
d, err = Getwd()
if err != nil {
t.Fatal("Getwd: %v", err)
}
close(c) close(c)
for i := 0; i < N; i++ { for i := 0; i < N; i++ {
pwd := <-cpwd pwd := <-cpwd
if pwd != d { if pwd != d {
t.Errorf("Getwd returned %q want %q", pwd, d) t.Errorf("Getwd returned %q; want %q", pwd, d)
} }
} }
} }
......
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