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/8842
Reviewed-by: David Crawshaw <crawshaw@golang.org>
diff --git a/src/os/os_test.go b/src/os/os_test.go
index f65845a..b1fc998 100644
--- a/src/os/os_test.go
+++ b/src/os/os_test.go
@@ -1060,7 +1060,8 @@
<-c
pwd, err := Getwd()
if err != nil {
- t.Fatal("Getwd: %v", err)
+ t.Errorf("Getwd on goroutine %d: %v", i, err)
+ return
}
cpwd <- pwd
}(i)
@@ -1082,11 +1083,17 @@
if err := Chdir(d); err != nil {
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)
for i := 0; i < N; i++ {
pwd := <-cpwd
if pwd != d {
- t.Errorf("Getwd returned %q want %q", pwd, d)
+ t.Errorf("Getwd returned %q; want %q", pwd, d)
}
}
}