diff --git a/src/pkg/os/os_test.go b/src/pkg/os/os_test.go index ecae0f2029..acce3efe74 100644 --- a/src/pkg/os/os_test.go +++ b/src/pkg/os/os_test.go @@ -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) } }