]> Cypherpunks repositories - gostls13.git/commitdiff
os: check only user attributes in TestStatDirModeExec
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 30 Nov 2012 05:10:45 +0000 (16:10 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 30 Nov 2012 05:10:45 +0000 (16:10 +1100)
Some have their system setup in a particular way,
see http://golang.org/issue/4444#c3.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6851129

src/pkg/os/os_test.go

index ecae0f202992caf5bb2d6d9b35f5ac999d7f8b21..acce3efe7452a8a1a1f16d44b391ffae6c111951 100644 (file)
@@ -1098,12 +1098,22 @@ func TestLargeWriteToConsole(t *testing.T) {
 
 func TestStatDirModeExec(t *testing.T) {
        const mode = 0111
-       const path = "."
+
+       path, err := ioutil.TempDir("", "go-build")
+       if err != nil {
+               t.Fatalf("Failed to create temp directory: %v", err)
+       }
+       defer RemoveAll(path)
+
+       if err := Chmod(path, 0777); err != nil {
+               t.Fatalf("Chmod %q 0777: %v", path, err)
+       }
+
        dir, err := Stat(path)
        if err != nil {
                t.Fatalf("Stat %q (looking for mode %#o): %s", path, mode, err)
        }
        if dir.Mode()&mode != mode {
-               t.Errorf("Stat %q: mode %#o want %#o", path, dir.Mode(), mode)
+               t.Errorf("Stat %q: mode %#o want %#o", path, dir.Mode()&mode, mode)
        }
 }