]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix TestProgWideChdir on darwin
authorMikio Hara <mikioh.mikioh@gmail.com>
Mon, 13 Apr 2015 03:11:00 +0000 (12:11 +0900)
committerDavid Crawshaw <crawshaw@golang.org>
Mon, 13 Apr 2015 22:26:15 +0000 (22:26 +0000)
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>
src/os/os_test.go

index f65845af867bbb7ae14edeb1572356930981129b..b1fc998a90c0492d6b2afeb84064bed2bd6db852 100644 (file)
@@ -1060,7 +1060,8 @@ func TestProgWideChdir(t *testing.T) {
                        <-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 @@ func TestProgWideChdir(t *testing.T) {
        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)
                }
        }
 }