aboutsummaryrefslogtreecommitdiff
path: root/src/os/os_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/os_test.go')
-rw-r--r--src/os/os_test.go35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/os/os_test.go b/src/os/os_test.go
index 520916d880..2bb57d866f 100644
--- a/src/os/os_test.go
+++ b/src/os/os_test.go
@@ -52,7 +52,7 @@ var sysdir = func() *sysDir {
"libpowermanager.so",
},
}
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
wd, err := syscall.Getwd()
@@ -144,7 +144,7 @@ func localTmp() string {
switch runtime.GOOS {
case "android", "windows":
return TempDir()
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
return TempDir()
@@ -481,7 +481,7 @@ func TestReaddirnamesOneAtATime(t *testing.T) {
switch runtime.GOOS {
case "android":
dir = "/system/bin"
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
wd, err := Getwd()
@@ -1099,29 +1099,34 @@ func checkMode(t *testing.T, path string, mode FileMode) {
if err != nil {
t.Fatalf("Stat %q (looking for mode %#o): %s", path, mode, err)
}
- if dir.Mode()&0777 != mode {
+ if dir.Mode()&ModePerm != mode {
t.Errorf("Stat %q: mode %#o want %#o", path, dir.Mode(), mode)
}
}
func TestChmod(t *testing.T) {
- // Chmod is not supported under windows.
- if runtime.GOOS == "windows" {
- return
- }
f := newFile("TestChmod", t)
defer Remove(f.Name())
defer f.Close()
+ // Creation mode is read write
- if err := Chmod(f.Name(), 0456); err != nil {
- t.Fatalf("chmod %s 0456: %s", f.Name(), err)
+ fm := FileMode(0456)
+ if runtime.GOOS == "windows" {
+ fm = FileMode(0444) // read-only file
}
- checkMode(t, f.Name(), 0456)
+ if err := Chmod(f.Name(), fm); err != nil {
+ t.Fatalf("chmod %s %#o: %s", f.Name(), fm, err)
+ }
+ checkMode(t, f.Name(), fm)
- if err := f.Chmod(0123); err != nil {
- t.Fatalf("chmod %s 0123: %s", f.Name(), err)
+ fm = FileMode(0123)
+ if runtime.GOOS == "windows" {
+ fm = FileMode(0666) // read-write file
+ }
+ if err := f.Chmod(fm); err != nil {
+ t.Fatalf("chmod %s %#o: %s", f.Name(), fm, err)
}
- checkMode(t, f.Name(), 0123)
+ checkMode(t, f.Name(), fm)
}
func checkSize(t *testing.T, f *File, size int64) {
@@ -1299,7 +1304,7 @@ func TestChdirAndGetwd(t *testing.T) {
dirs = []string{"/system/bin"}
case "plan9":
dirs = []string{"/", "/usr"}
- case "darwin":
+ case "darwin", "ios":
switch runtime.GOARCH {
case "arm64":
dirs = nil