File tree 2 files changed +22
-10
lines changed 2 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -1204,6 +1204,7 @@ func TestChdirAndGetwd(t *testing.T) {
1204
1204
case "darwin" :
1205
1205
switch runtime .GOARCH {
1206
1206
case "arm" , "arm64" :
1207
+ dirs = nil
1207
1208
for _ , d := range []string {"d1" , "d2" } {
1208
1209
dir , err := ioutil .TempDir ("" , d )
1209
1210
if err != nil {
Original file line number Diff line number Diff line change @@ -13,20 +13,31 @@ import (
13
13
)
14
14
15
15
var zoneSources = []string {
16
- getZipParent () + "/zoneinfo.zip" ,
17
- runtime .GOROOT () + "/lib/time/zoneinfo.zip" ,
16
+ getZoneRoot () + "/zoneinfo.zip" ,
18
17
}
19
18
20
- func getZipParent () string {
21
- wd , err := syscall .Getwd ()
22
- if err != nil {
23
- return "/XXXNOEXIST"
24
- }
25
-
19
+ func getZoneRoot () string {
26
20
// The working directory at initialization is the root of the
27
21
// app bundle: "/private/.../bundlename.app". That's where we
28
- // keep zoneinfo.zip.
29
- return wd
22
+ // keep zoneinfo.zip for tethered iOS builds.
23
+ // For self-hosted iOS builds, the zoneinfo.zip is in GOROOT.
24
+ roots := []string {runtime .GOROOT () + "/lib/time" }
25
+ wd , err := syscall .Getwd ()
26
+ if err == nil {
27
+ roots = append (roots , wd )
28
+ }
29
+ for _ , r := range roots {
30
+ var st syscall.Stat_t
31
+ fd , err := syscall .Open (r , syscall .O_RDONLY , 0 )
32
+ if err != nil {
33
+ continue
34
+ }
35
+ defer syscall .Close (fd )
36
+ if err := syscall .Fstat (fd , & st ); err == nil {
37
+ return r
38
+ }
39
+ }
40
+ return "/XXXNOEXIST"
30
41
}
31
42
32
43
func initLocal () {
You can’t perform that action at this time.
0 commit comments