]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "cmd/go, misc: rework cwd handling for iOS tests"
authorElias Naur <elias.naur@gmail.com>
Sat, 4 Mar 2017 00:15:14 +0000 (01:15 +0100)
committerElias Naur <elias.naur@gmail.com>
Sat, 4 Mar 2017 00:18:42 +0000 (00:18 +0000)
This reverts commit 593ea3b3606a16da39e38406e22e373eeb944287.

Replaced by a improved strategy later in the CL relation chain.

Change-Id: I6963e4d1bf38e7028cf545a953e28054d83548
Change-Id: I6963e4d1bf38e7028cf545a953e28054d8354870
Reviewed-on: https://go-review.googlesource.com/36067
Reviewed-by: David Crawshaw <crawshaw@golang.org>
misc/ios/go_darwin_arm_exec.go
src/cmd/go/internal/test/test.go

index fce71a0597c576e9f5ee65622d6ade97f6ccfbe2..ad7a72c9a6c6b3e48cbd0308c834cded518a7636 100644 (file)
@@ -212,11 +212,6 @@ func run(bin string, args []string) (err error) {
        var opts options
        opts, args = parseArgs(args)
 
-       // Pass the suffix for the current working directory as the
-       // first argument to the test. For iOS, cmd/go generates
-       // special handling of this argument.
-       args = append([]string{"cwdSuffix=" + pkgpath}, args...)
-
        // ios-deploy invokes lldb to give us a shell session with the app.
        s, err := newSession(appdir, args, opts)
        if err != nil {
@@ -254,6 +249,15 @@ func run(bin string, args []string) (err error) {
 
        s.doCmd("run", "stop reason = signal SIGUSR2", 20*time.Second)
 
+       // Move the current working directory into the faux gopath.
+       if pkgpath != "src" {
+               s.do(`breakpoint delete 1`)
+               s.do(`expr char* $mem = (char*)malloc(512)`)
+               s.do(`expr $mem = (char*)getwd($mem, 512)`)
+               s.do(`expr $mem = (char*)strcat($mem, "/` + pkgpath + `")`)
+               s.do(`call (void)chdir($mem)`)
+       }
+
        startTestsLen := s.out.Len()
        fmt.Fprintln(s.in, `process continue`)
 
index feafaad2a8ba23ef5486b58f2732fd1b43d3e2d0..6a02f5ab2ed4cd689ba4d80bd8572ff4e1eab602 100644 (file)
@@ -1562,28 +1562,12 @@ func coverRegisterFile(fileName string, counter []uint32, pos []uint32, numStmts
 func main() {
 {{if .IsIOS}}
        // Send a SIGUSR2, which will be intercepted by LLDB to
-       // tell the test harness that installation was successful.
-       // See misc/ios/go_darwin_arm_exec.go.
+       // tell the test harness that installation was successful,
+       // and to give the exec script a chance set the current
+       // working directory. See misc/ios/go_darwin_arm_exec.go.
        signal.Notify(make(chan os.Signal), syscall.SIGUSR2)
        syscall.Kill(0, syscall.SIGUSR2)
        signal.Reset(syscall.SIGUSR2)
-
-       // The first argument supplied to an iOS test is an offset
-       // suffix for the current working directory.
-       // Process it here, and remove it from os.Args.
-       const hdr = "cwdSuffix="
-       if len(os.Args) < 2 || len(os.Args[1]) <= len(hdr) || os.Args[1][:len(hdr)] != hdr {
-               panic("iOS test not passed a working directory suffix")
-       }
-       suffix := os.Args[1][len(hdr):]
-       dir, err := os.Getwd()
-       if err != nil {
-               panic(err)
-       }
-       if err := os.Chdir(dir + "/" + suffix); err != nil {
-               panic(err)
-       }
-       os.Args = append([]string{os.Args[0]}, os.Args[2:]...)
 {{end}}
 
 {{if .CoverEnabled}}