Lines Matching +full:qemu +full:- +full:run
2 # Use of this source code is governed by a BSD-style license that can be
4 """Utility to run a Brillo emulator programmatically.
23 """Bad port, missing artifact or non-existant imagedir."""
33 @param run: Function used to execute shell commands.
35 def __init__(self, imagedir, port, run=utils.run): argument
40 run('test -f %s' % os.path.join(imagedir, 'system.img'))
47 self.run = run
55 @return: Bool - True if emulator stops.
73 cmd_result = self.run('find "%s" -name "*.dtb"' % self.imagedir)
87 '-dmS', 'emulator-%s' % self.port, 'qemu-system-arm',
88 '-M', 'vexpress-a9',
89 '-m', '1024M',
90 '-kernel', os.path.join(self.imagedir, 'kernel'),
91 '-append', ('"console=ttyAMA0 ro root=/dev/sda '
92 'androidboot.hardware=qemu qemu=1 rootwait noinitrd '
94 '-nographic',
95 '-device', 'virtio-scsi-device,id=scsi',
96 '-device', 'scsi-hd,drive=system',
97 '-drive', ('file="%s,if=none,id=system,format=raw"'
99 '-device', 'scsi-hd,drive=userdata',
100 '-drive', ('file="%s,if=none,id=userdata,format=raw"'
102 '-redir', 'tcp:%s::5555' % self.port,
108 args += ['-dtb', dtb]
113 self.run(' '.join(['screen'] + args))
117 """Detect the PID of a qemu process running on our port.
121 running = self.run('netstat -nlpt').stdout
124 process = proc.split()[-1]
132 Signal is sent to any running qemu process on our port regardless of how
133 it was started. Silent no-op if no running qemu processes on the port.
139 cmd = 'kill -9 %s' if kill else 'kill %s'
140 self.run(cmd % pid)