]> Cypherpunks repositories - gostls13.git/commitdiff
path/filepath: get tests working on darwin/arm
authorDavid Crawshaw <crawshaw@golang.org>
Sun, 1 Mar 2015 03:55:29 +0000 (22:55 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Sun, 1 Mar 2015 18:38:21 +0000 (18:38 +0000)
Change-Id: Ic44d7837aaec58601e5d9cad8da5b958a809f4a0
Reviewed-on: https://go-review.googlesource.com/6400
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/path/filepath/path_test.go

index 293d316124599f009874eac4cfead6528b85b35c..aac7911d432211a90c18eb1c9ee41dc2fba7e059 100644 (file)
@@ -399,7 +399,31 @@ func mark(path string, info os.FileInfo, err error, errors *[]error, clear bool)
        return nil
 }
 
+func chtmpdir(t *testing.T) (restore func()) {
+       oldwd, err := os.Getwd()
+       if err != nil {
+               t.Fatal("chtmpdir: %v", err)
+       }
+       d, err := ioutil.TempDir("", "test")
+       if err != nil {
+               t.Fatal("chtmpdir: %v", err)
+       }
+       if err := os.Chdir(d); err != nil {
+               t.Fatal("chtmpdir: %v", err)
+       }
+       return func() {
+               if err := os.Chdir(oldwd); err != nil {
+                       t.Fatal("chtmpdir: %v", err)
+               }
+               os.RemoveAll(d)
+       }
+}
+
 func TestWalk(t *testing.T) {
+       if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
+               restore := chtmpdir(t)
+               defer restore()
+       }
        makeTree(t)
        errors := make([]error, 0, 10)
        clear := true
@@ -1009,6 +1033,9 @@ func TestDriveLetterInEvalSymlinks(t *testing.T) {
 }
 
 func TestBug3486(t *testing.T) { // http://golang.org/issue/3486
+       if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
+               t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
+       }
        root, err := filepath.EvalSymlinks(runtime.GOROOT() + "/test")
        if err != nil {
                t.Fatal(err)