Commit 84efd6fc authored by David Crawshaw's avatar David Crawshaw

os: adjust working dir for darwin/arm64 tests

Just like darwin/arm.

Change-Id: Ib64a3e8ff11249a20b0208bd3b900db318c682b7
Reviewed-on: https://go-review.googlesource.com/8817Reviewed-by: default avatarMinux Ma <minux@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 2e613152
...@@ -53,7 +53,8 @@ var sysdir = func() *sysDir { ...@@ -53,7 +53,8 @@ var sysdir = func() *sysDir {
}, },
} }
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
wd, err := syscall.Getwd() wd, err := syscall.Getwd()
if err != nil { if err != nil {
wd = err.Error() wd = err.Error()
...@@ -131,7 +132,8 @@ func localTmp() string { ...@@ -131,7 +132,8 @@ func localTmp() string {
case "android", "windows": case "android", "windows":
return TempDir() return TempDir()
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
return TempDir() return TempDir()
} }
} }
...@@ -323,7 +325,8 @@ func TestReaddirnamesOneAtATime(t *testing.T) { ...@@ -323,7 +325,8 @@ func TestReaddirnamesOneAtATime(t *testing.T) {
case "android": case "android":
dir = "/system/bin" dir = "/system/bin"
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
wd, err := Getwd() wd, err := Getwd()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -534,15 +537,10 @@ func TestReaddirOfFile(t *testing.T) { ...@@ -534,15 +537,10 @@ func TestReaddirOfFile(t *testing.T) {
} }
func TestHardLink(t *testing.T) { func TestHardLink(t *testing.T) {
// Hardlinks are not supported under windows or Plan 9. if runtime.GOOS == "plan9" {
switch runtime.GOOS { t.Skip("skipping on plan9, hardlinks not supported")
case "plan9":
return
case "darwin":
if runtime.GOARCH == "arm" {
defer chtmpdir(t)()
}
} }
defer chtmpdir(t)()
from, to := "hardlinktestfrom", "hardlinktestto" from, to := "hardlinktestfrom", "hardlinktestto"
Remove(from) // Just in case. Remove(from) // Just in case.
file, err := Create(to) file, err := Create(to)
...@@ -582,6 +580,9 @@ func TestHardLink(t *testing.T) { ...@@ -582,6 +580,9 @@ func TestHardLink(t *testing.T) {
// chtmpdir changes the working directory to a new temporary directory and // chtmpdir changes the working directory to a new temporary directory and
// provides a cleanup function. Used when PWD is read-only. // provides a cleanup function. Used when PWD is read-only.
func chtmpdir(t *testing.T) func() { func chtmpdir(t *testing.T) func() {
if runtime.GOOS != "darwin" || (runtime.GOARCH != "arm" && runtime.GOARCH != "arm64") {
return func() {} // only needed on darwin/arm{,64}
}
oldwd, err := Getwd() oldwd, err := Getwd()
if err != nil { if err != nil {
t.Fatalf("chtmpdir: %v", err) t.Fatalf("chtmpdir: %v", err)
...@@ -609,11 +610,8 @@ func TestSymlink(t *testing.T) { ...@@ -609,11 +610,8 @@ func TestSymlink(t *testing.T) {
if !supportsSymlinks { if !supportsSymlinks {
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
} }
case "darwin":
if runtime.GOARCH == "arm" {
defer chtmpdir(t)()
}
} }
defer chtmpdir(t)()
from, to := "symlinktestfrom", "symlinktestto" from, to := "symlinktestfrom", "symlinktestto"
Remove(from) // Just in case. Remove(from) // Just in case.
file, err := Create(to) file, err := Create(to)
...@@ -679,11 +677,8 @@ func TestLongSymlink(t *testing.T) { ...@@ -679,11 +677,8 @@ func TestLongSymlink(t *testing.T) {
if !supportsSymlinks { if !supportsSymlinks {
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
} }
case "darwin":
if runtime.GOARCH == "arm" {
defer chtmpdir(t)()
}
} }
defer chtmpdir(t)()
s := "0123456789abcdef" s := "0123456789abcdef"
// Long, but not too long: a common limit is 255. // Long, but not too long: a common limit is 255.
s = s + s + s + s + s + s + s + s + s + s + s + s + s + s + s s = s + s + s + s + s + s + s + s + s + s + s + s + s + s + s
...@@ -704,9 +699,7 @@ func TestLongSymlink(t *testing.T) { ...@@ -704,9 +699,7 @@ func TestLongSymlink(t *testing.T) {
} }
func TestRename(t *testing.T) { func TestRename(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
defer chtmpdir(t)() defer chtmpdir(t)()
}
from, to := "renamefrom", "renameto" from, to := "renamefrom", "renameto"
// Ensure we are not testing the overwrite case here. // Ensure we are not testing the overwrite case here.
Remove(from) Remove(from)
...@@ -734,9 +727,7 @@ func TestRenameOverwriteDest(t *testing.T) { ...@@ -734,9 +727,7 @@ func TestRenameOverwriteDest(t *testing.T) {
if runtime.GOOS == "plan9" { if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9") t.Skip("skipping on plan9")
} }
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
defer chtmpdir(t)() defer chtmpdir(t)()
}
from, to := "renamefrom", "renameto" from, to := "renamefrom", "renameto"
// Just in case. // Just in case.
Remove(from) Remove(from)
...@@ -807,8 +798,9 @@ func TestStartProcess(t *testing.T) { ...@@ -807,8 +798,9 @@ func TestStartProcess(t *testing.T) {
case "android", "nacl": case "android", "nacl":
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH) case "arm", "arm64":
t.Skipf("skipping on %s/%s, cannot fork", runtime.GOOS, runtime.GOARCH)
} }
} }
...@@ -991,7 +983,8 @@ func TestChdirAndGetwd(t *testing.T) { ...@@ -991,7 +983,8 @@ func TestChdirAndGetwd(t *testing.T) {
case "plan9": case "plan9":
dirs = []string{"/", "/usr"} dirs = []string{"/", "/usr"}
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
d1, err := ioutil.TempDir("", "d1") d1, err := ioutil.TempDir("", "d1")
if err != nil { if err != nil {
t.Fatalf("TempDir: %v", err) t.Fatalf("TempDir: %v", err)
...@@ -1211,8 +1204,9 @@ func TestHostname(t *testing.T) { ...@@ -1211,8 +1204,9 @@ func TestHostname(t *testing.T) {
case "android", "nacl", "plan9": case "android", "nacl", "plan9":
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH) case "arm", "arm64":
t.Skipf("skipping on %s/%s, cannot fork", runtime.GOOS, runtime.GOARCH)
} }
case "windows": case "windows":
testWindowsHostname(t) testWindowsHostname(t)
...@@ -1293,9 +1287,7 @@ func writeFile(t *testing.T, fname string, flag int, text string) string { ...@@ -1293,9 +1287,7 @@ func writeFile(t *testing.T, fname string, flag int, text string) string {
} }
func TestAppend(t *testing.T) { func TestAppend(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
defer chtmpdir(t)() defer chtmpdir(t)()
}
const f = "append.txt" const f = "append.txt"
defer Remove(f) defer Remove(f)
s := writeFile(t, f, O_CREATE|O_TRUNC|O_RDWR, "new") s := writeFile(t, f, O_CREATE|O_TRUNC|O_RDWR, "new")
...@@ -1359,9 +1351,7 @@ func TestNilProcessStateString(t *testing.T) { ...@@ -1359,9 +1351,7 @@ func TestNilProcessStateString(t *testing.T) {
} }
func TestSameFile(t *testing.T) { func TestSameFile(t *testing.T) {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
defer chtmpdir(t)() defer chtmpdir(t)()
}
fa, err := Create("a") fa, err := Create("a")
if err != nil { if err != nil {
t.Fatalf("Create(a): %v", err) t.Fatalf("Create(a): %v", err)
...@@ -1485,7 +1475,8 @@ func testKillProcess(t *testing.T, processKiller func(p *Process)) { ...@@ -1485,7 +1475,8 @@ func testKillProcess(t *testing.T, processKiller func(p *Process)) {
case "android", "nacl": case "android", "nacl":
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
} }
} }
...@@ -1532,7 +1523,8 @@ func TestGetppid(t *testing.T) { ...@@ -1532,7 +1523,8 @@ func TestGetppid(t *testing.T) {
// TODO: golang.org/issue/8206 // TODO: golang.org/issue/8206
t.Skipf("skipping test on plan9; see issue 8206") t.Skipf("skipping test on plan9; see issue 8206")
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
t.Skipf("skipping test on %s/%s, no fork", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping test on %s/%s, no fork", runtime.GOOS, runtime.GOARCH)
} }
} }
......
...@@ -208,7 +208,8 @@ func TestMkdirAllAtSlash(t *testing.T) { ...@@ -208,7 +208,8 @@ func TestMkdirAllAtSlash(t *testing.T) {
case "android", "plan9", "windows": case "android", "plan9", "windows":
t.Skipf("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
case "darwin": case "darwin":
if runtime.GOARCH == "arm" { switch runtime.GOARCH {
case "arm", "arm64":
t.Skipf("skipping on darwin/%s, mkdir returns EPERM", runtime.GOARCH) t.Skipf("skipping on darwin/%s, mkdir returns EPERM", runtime.GOARCH)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment