diff options
| -rw-r--r-- | vm/adb/adb.go | 25 | ||||
| -rw-r--r-- | vm/vmimpl/console.go | 27 |
2 files changed, 28 insertions, 24 deletions
diff --git a/vm/adb/adb.go b/vm/adb/adb.go index 19766cf18..45b0d7f2a 100644 --- a/vm/adb/adb.go +++ b/vm/adb/adb.go @@ -38,7 +38,6 @@ type Device struct { type Config struct { Adb string `json:"adb"` // adb binary name ("adb" by default) Devices []Device `json:"devices"` // list of adb devices to use - CvdDir string `json:"cvd_dir"` // cvd directory path of cuttlefish // Ensure that a device battery level is at 20+% before fuzzing. // Sometimes we observe that a device can't charge during heavy fuzzing @@ -440,29 +439,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin var err error if ok, ip := isRemoteCuttlefish(inst.device); ok { - log.Logf(0, "running on remote cuttlefish: %v", ip) - conRpipe, conWpipe, err := osutil.LongPipe() - if err != nil { - return nil, nil, err - } - conAddr := "vsoc-01@" + ip - con := osutil.Command("ssh", "-t", conAddr, "screen", inst.console) - con.Env = []string{} - con.Stdout = conWpipe - con.Stderr = conWpipe - if _, err := con.StdinPipe(); err != nil { - conRpipe.Close() - conWpipe.Close() - return nil, nil, err - } - if err := con.Start(); err != nil { - conRpipe.Close() - conWpipe.Close() - return nil, nil, fmt.Errorf("failed to connect to console server: %v", err) - } - tty = conRpipe - conWpipe.Close() - + tty, err = vmimpl.OpenRemoteKernelLog(ip, inst.console) } else if inst.console == "adb" { tty, err = vmimpl.OpenAdbConsole(inst.adbBin, inst.device) } else { diff --git a/vm/vmimpl/console.go b/vm/vmimpl/console.go index 8688a0b52..38314bcf5 100644 --- a/vm/vmimpl/console.go +++ b/vm/vmimpl/console.go @@ -76,6 +76,33 @@ func (t *tty) Close() error { return nil } +func OpenRemoteKernelLog(ip string, console string) (rc io.ReadCloser, err error) { + rpipe, wpipe, err := osutil.LongPipe() + if err != nil { + return nil, err + } + conAddr := "vsoc-01@" + ip + cmd := osutil.Command("ssh", conAddr, "tail", "-f", console) + cmd.Stdout = wpipe + cmd.Stderr = wpipe + if _, err := cmd.StdinPipe(); err != nil { + rpipe.Close() + wpipe.Close() + return nil, err + } + if err := cmd.Start(); err != nil { + rpipe.Close() + wpipe.Close() + return nil, fmt.Errorf("failed to connect to console server: %v", err) + } + wpipe.Close() + con := &remoteCon{ + cmd: cmd, + rpipe: rpipe, + } + return con, nil +} + // Open dmesg remotely. func OpenRemoteConsole(bin string, args ...string) (rc io.ReadCloser, err error) { rpipe, wpipe, err := osutil.LongPipe() |
