aboutsummaryrefslogtreecommitdiffstats
path: root/vm/cuttlefish
diff options
context:
space:
mode:
authorLiz Prucka <lizprucka@google.com>2022-08-31 20:05:37 +0000
committerDmitry Vyukov <dvyukov@google.com>2022-09-02 12:30:43 +0200
commitb66bf060edd28ff43a7a61e99fd0c879861bca33 (patch)
treefb70e5cab3b35a10b64cd96becbac1b50bf3c3cf /vm/cuttlefish
parenta577205ebe1f58124fc8b58e3ccc2ac2d690e89d (diff)
vm/cuttlefish: run commands from deviceRoot
Create the the deviceRoot directory, then run adb commands from deviceRoot (data/fuzz). Additionally, added quotes in adb shell mounting command; commands should be run inside shell.
Diffstat (limited to 'vm/cuttlefish')
-rw-r--r--vm/cuttlefish/cuttlefish.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/vm/cuttlefish/cuttlefish.go b/vm/cuttlefish/cuttlefish.go
index f1e0b88ea..dd2a0e898 100644
--- a/vm/cuttlefish/cuttlefish.go
+++ b/vm/cuttlefish/cuttlefish.go
@@ -81,8 +81,12 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
return nil, fmt.Errorf("failed to get root access to device: %s", err)
}
- if err := inst.runOnHost(5*time.Minute, fmt.Sprintf("adb shell setprop persist.dbg.keep_debugfs_mounted 1;"+
- "mount -t debugfs debugfs /sys/kernel/debug; chmod 0755 /sys/kernel/debug")); err != nil {
+ if err := inst.runOnHost(5*time.Minute, fmt.Sprintf("adb shell '"+
+ "setprop persist.dbg.keep_debugfs_mounted 1;"+
+ "mount -t debugfs debugfs /sys/kernel/debug;"+
+ "chmod 0755 /sys/kernel/debug;"+
+ "mkdir %s;"+
+ "'", deviceRoot)); err != nil {
return nil, fmt.Errorf("failed to mount debugfs to /sys/kernel/debug: %s", err)
}
@@ -154,7 +158,7 @@ func (inst *instance) Close() {
func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command string) (
<-chan []byte, <-chan error, error) {
- return inst.gceInst.Run(timeout, stop, fmt.Sprintf("adb shell %s", command))
+ return inst.gceInst.Run(timeout, stop, fmt.Sprintf("adb shell 'cd %s; %s'", deviceRoot, command))
}
func (inst *instance) Diagnose(rep *report.Report) ([]byte, bool) {