mirror of
https://github.com/golang/go
synced 2024-11-12 03:40:21 -07:00
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
This commit is contained in:
parent
9c2f410206
commit
902af974cb
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user