1
0
mirror of https://github.com/golang/go synced 2024-11-26 23:31:24 -07:00

misc/ios: adjust exec script for iOS 8.3

We no longer need the EXC_BAD_ACCESS watcher as runtime/cgo contains
a mach exception handler that catches it. And now lldb only
intermittently reports process connection and exiting, so instead
just look for the PASS from Go.

Change-Id: I403266558f5a900e0b87ec1019d9baec88148d23
Reviewed-on: https://go-review.googlesource.com/8957
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
David Crawshaw 2015-04-15 14:59:46 -04:00
parent 5cc8561333
commit e6d5233cfe

View File

@ -257,7 +257,7 @@ func run(bin string, args []string) (err error) {
} }
// Wait for installation and connection. // Wait for installation and connection.
if err := waitFor("ios-deploy before run", "(lldb) connect\r\nProcess 0 connected\r\n", 0); err != nil { if err := waitFor("ios-deploy before run", "(lldb)", 0); err != nil {
// Retry if we see a rare and longstanding ios-deploy bug. // Retry if we see a rare and longstanding ios-deploy bug.
// https://github.com/phonegap/ios-deploy/issues/11 // https://github.com/phonegap/ios-deploy/issues/11
// Assertion failed: (AMDeviceStartService(device, CFSTR("com.apple.debugserver"), &gdbfd, NULL) == 0) // Assertion failed: (AMDeviceStartService(device, CFSTR("com.apple.debugserver"), &gdbfd, NULL) == 0)
@ -313,20 +313,6 @@ func run(bin string, args []string) (err error) {
do(`call (void)chdir($mem)`) do(`call (void)chdir($mem)`)
} }
// Watch for SIGSEGV. Ideally lldb would never break on SIGSEGV.
// http://golang.org/issue/10043
go func() {
<-w.find("stop reason = EXC_BAD_ACCESS", 0)
// cannot use do here, as the defer/recover is not available
// on this goroutine.
fmt.Fprintln(lldb, `bt`)
waitFor("finish backtrace", "(lldb)", 0)
w.printBuf()
if p := cmd.Process; p != nil {
p.Kill()
}
}()
// Run the tests. // Run the tests.
w.trimSuffix("(lldb) ") w.trimSuffix("(lldb) ")
fmt.Fprintln(lldb, `process continue`) fmt.Fprintln(lldb, `process continue`)
@ -339,6 +325,13 @@ func run(bin string, args []string) (err error) {
p.Kill() p.Kill()
} }
return errors.New("timeout running tests") return errors.New("timeout running tests")
case <-w.find("\nPASS", 0):
passed := w.isPass()
w.printBuf()
if passed {
return nil
}
return errors.New("test failure")
case err := <-exited: case err := <-exited:
// The returned lldb error code is usually non-zero. // The returned lldb error code is usually non-zero.
// We check for test success by scanning for the final // We check for test success by scanning for the final
@ -371,6 +364,12 @@ func (w *bufWriter) Write(in []byte) (n int, err error) {
n = len(in) n = len(in)
in = bytes.TrimSuffix(in, w.suffix) in = bytes.TrimSuffix(in, w.suffix)
if debug {
inTxt := strings.Replace(string(in), "\n", "\\n", -1)
findTxt := strings.Replace(string(w.findTxt), "\n", "\\n", -1)
fmt.Printf("debug --> %s <-- debug (findTxt='%s')\n", inTxt, findTxt)
}
w.buf = append(w.buf, in...) w.buf = append(w.buf, in...)
if len(w.findTxt) > 0 { if len(w.findTxt) > 0 {
@ -404,9 +403,6 @@ func (w *bufWriter) printBuf() {
func (w *bufWriter) clearTo(i int) { func (w *bufWriter) clearTo(i int) {
w.mu.Lock() w.mu.Lock()
defer w.mu.Unlock() defer w.mu.Unlock()
if debug {
fmt.Fprintf(os.Stderr, "--- go_darwin_arm_exec clear ---\n%s\n--- go_darwin_arm_exec clear ---\n", w.buf[:i])
}
w.buf = w.buf[i:] w.buf = w.buf[i:]
} }