diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/core/target/qemu.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/target/qemu.py b/meta/lib/oeqa/core/target/qemu.py new file mode 100644 index 0000000000..641dd6a093 --- /dev/null +++ b/meta/lib/oeqa/core/target/qemu.py | |||
@@ -0,0 +1,45 @@ | |||
1 | # Copyright (C) 2016 Intel Corporation | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | import os | ||
5 | import sys | ||
6 | import signal | ||
7 | import time | ||
8 | |||
9 | from .ssh import OESSHTarget | ||
10 | from oeqa.utils.qemurunner import QemuRunner | ||
11 | |||
12 | supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic'] | ||
13 | |||
14 | class OEQemuTarget(OESSHTarget): | ||
15 | def __init__(self, logger, ip, server_ip, timeout=300, user='root', | ||
16 | port=None, machine='', rootfs='', kernel='', kvm=False, | ||
17 | dump_dir='', dump_host_cmds='', display='', bootlog='', | ||
18 | tmpdir='', dir_image='', boottime=60): | ||
19 | |||
20 | super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout, | ||
21 | user, port) | ||
22 | |||
23 | self.ip = ip | ||
24 | self.server_ip = server_ip | ||
25 | self.machine = machine | ||
26 | self.rootfs = rootfs | ||
27 | self.kernel = kernel | ||
28 | self.kvm = kvm | ||
29 | |||
30 | self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir, | ||
31 | deploy_dir_image=dir_image, display=display, | ||
32 | logfile=bootlog, boottime=boottime, | ||
33 | use_kvm=kvm, dump_dir=dump_dir, | ||
34 | dump_host_cmds=dump_host_cmds) | ||
35 | |||
36 | def start(self, params=None, extra_bootparams=None): | ||
37 | if self.runner.start(params, extra_bootparams=extra_bootparams): | ||
38 | self.ip = self.runner.ip | ||
39 | self.server_ip = self.runner.server_ip | ||
40 | else: | ||
41 | self.stop() | ||
42 | raise RuntimeError("FAILED to start qemu - check the task log and the boot log") | ||
43 | |||
44 | def stop(self): | ||
45 | self.runner.stop() | ||