Commit 08318f59 authored by Elias Naur's avatar Elias Naur

os: fix tests on self-hosted Go builds

Updates #31722

Change-Id: I467bb2539f993fad642abf96388a58a263fbe007
Reviewed-on: https://go-review.googlesource.com/c/go/+/174311
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 85387aa3
......@@ -59,13 +59,26 @@ var sysdir = func() *sysDir {
if err != nil {
wd = err.Error()
}
return &sysDir{
sd := &sysDir{
filepath.Join(wd, "..", ".."),
[]string{
"ResourceRules.plist",
"Info.plist",
},
}
found := true
for _, f := range sd.files {
path := filepath.Join(sd.name, f)
if _, err := Stat(path); err != nil {
found = false
break
}
}
if found {
return sd
}
// In a self-hosted iOS build the above files might
// not exist. Look for system files instead below.
}
case "windows":
return &sysDir{
......@@ -1191,15 +1204,18 @@ func TestChdirAndGetwd(t *testing.T) {
case "darwin":
switch runtime.GOARCH {
case "arm", "arm64":
d1, err := ioutil.TempDir("", "d1")
for _, d := range []string{"d1", "d2"} {
dir, err := ioutil.TempDir("", d)
if err != nil {
t.Fatalf("TempDir: %v", err)
}
d2, err := ioutil.TempDir("", "d2")
// Expand symlinks so path equality tests work.
dir, err = filepath.EvalSymlinks(dir)
if err != nil {
t.Fatalf("TempDir: %v", err)
t.Fatalf("EvalSymlinks: %v", err)
}
dirs = append(dirs, dir)
}
dirs = []string{d1, d2}
}
}
oldwd := Getenv("PWD")
......
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