From: Alex Brainman Date: Fri, 30 Nov 2012 05:10:45 +0000 (+1100) Subject: os: check only user attributes in TestStatDirModeExec X-Git-Tag: go1.1rc2~1749 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=902af974cbdf3af5ae435e3d34f2ac16beb207d1;p=gostls13.git os: check only user attributes in TestStatDirModeExec 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 --- 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) } }