},
}
case "darwin":
- if runtime.GOARCH == "arm" {
+ switch runtime.GOARCH {
+ case "arm", "arm64":
wd, err := syscall.Getwd()
if err != nil {
wd = err.Error()
case "android", "windows":
return TempDir()
case "darwin":
- if runtime.GOARCH == "arm" {
+ switch runtime.GOARCH {
+ case "arm", "arm64":
return TempDir()
}
}
case "android":
dir = "/system/bin"
case "darwin":
- if runtime.GOARCH == "arm" {
+ switch runtime.GOARCH {
+ case "arm", "arm64":
wd, err := Getwd()
if err != nil {
t.Fatal(err)
}
func TestHardLink(t *testing.T) {
- // Hardlinks are not supported under windows or Plan 9.
- switch runtime.GOOS {
- case "plan9":
- return
- case "darwin":
- if runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
+ if runtime.GOOS == "plan9" {
+ t.Skip("skipping on plan9, hardlinks not supported")
}
+ defer chtmpdir(t)()
from, to := "hardlinktestfrom", "hardlinktestto"
Remove(from) // Just in case.
file, err := Create(to)
// chtmpdir changes the working directory to a new temporary directory and
// provides a cleanup function. Used when PWD is read-only.
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()
if err != nil {
t.Fatalf("chtmpdir: %v", err)
if !supportsSymlinks {
t.Skipf("skipping on %s", runtime.GOOS)
}
- case "darwin":
- if runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
}
+ defer chtmpdir(t)()
from, to := "symlinktestfrom", "symlinktestto"
Remove(from) // Just in case.
file, err := Create(to)
if !supportsSymlinks {
t.Skipf("skipping on %s", runtime.GOOS)
}
- case "darwin":
- if runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
}
+ defer chtmpdir(t)()
s := "0123456789abcdef"
// 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
}
func TestRename(t *testing.T) {
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
+ defer chtmpdir(t)()
from, to := "renamefrom", "renameto"
// Ensure we are not testing the overwrite case here.
Remove(from)
if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9")
}
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
+ defer chtmpdir(t)()
from, to := "renamefrom", "renameto"
// Just in case.
Remove(from)
case "android", "nacl":
t.Skipf("skipping on %s", runtime.GOOS)
case "darwin":
- if runtime.GOARCH == "arm" {
- t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
+ switch runtime.GOARCH {
+ case "arm", "arm64":
+ t.Skipf("skipping on %s/%s, cannot fork", runtime.GOOS, runtime.GOARCH)
}
}
case "plan9":
dirs = []string{"/", "/usr"}
case "darwin":
- if runtime.GOARCH == "arm" {
+ switch runtime.GOARCH {
+ case "arm", "arm64":
d1, err := ioutil.TempDir("", "d1")
if err != nil {
t.Fatalf("TempDir: %v", err)
case "android", "nacl", "plan9":
t.Skipf("skipping on %s", runtime.GOOS)
case "darwin":
- if runtime.GOARCH == "arm" {
- t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
+ switch runtime.GOARCH {
+ case "arm", "arm64":
+ t.Skipf("skipping on %s/%s, cannot fork", runtime.GOOS, runtime.GOARCH)
}
case "windows":
testWindowsHostname(t)
}
func TestAppend(t *testing.T) {
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
+ defer chtmpdir(t)()
const f = "append.txt"
defer Remove(f)
s := writeFile(t, f, O_CREATE|O_TRUNC|O_RDWR, "new")
}
func TestSameFile(t *testing.T) {
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
- defer chtmpdir(t)()
- }
+ defer chtmpdir(t)()
fa, err := Create("a")
if err != nil {
t.Fatalf("Create(a): %v", err)
case "android", "nacl":
t.Skipf("skipping on %s", runtime.GOOS)
case "darwin":
- if runtime.GOARCH == "arm" {
+ switch runtime.GOARCH {
+ case "arm", "arm64":
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
}
}
// TODO: golang.org/issue/8206
t.Skipf("skipping test on plan9; see issue 8206")
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)
}
}