本文整理汇总了Python中oeqa.utils.qemurunner.QemuRunner.restart方法的典型用法代码示例。如果您正苦于以下问题:Python QemuRunner.restart方法的具体用法?Python QemuRunner.restart怎么用?Python QemuRunner.restart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oeqa.utils.qemurunner.QemuRunner
的用法示例。
在下文中一共展示了QemuRunner.restart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QemuTarget
# 需要导入模块: from oeqa.utils.qemurunner import QemuRunner [as 别名]
# 或者: from oeqa.utils.qemurunner.QemuRunner import restart [as 别名]
class QemuTarget(BaseTarget):
supported_image_fstypes = ['ext3']
def __init__(self, d):
super(QemuTarget, self).__init__(d)
self.image_fstype = self.get_image_fstype(d)
self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + '.' + self.image_fstype)
self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.' + self.image_fstype)
self.runner = QemuRunner(machine=d.getVar("MACHINE", True),
rootfs=self.rootfs,
tmpdir = d.getVar("TMPDIR", True),
deploy_dir_image = d.getVar("DEPLOY_DIR_IMAGE", True),
display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True),
logfile = self.qemulog,
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)))
def deploy(self):
try:
shutil.copyfile(self.origrootfs, self.rootfs)
except Exception as e:
bb.fatal("Error copying rootfs: %s" % e)
qemuloglink = os.path.join(self.testdir, "qemu_boot_log")
if os.path.islink(qemuloglink):
os.unlink(qemuloglink)
os.symlink(self.qemulog, qemuloglink)
bb.note("rootfs file: %s" % self.rootfs)
bb.note("Qemu log file: %s" % self.qemulog)
super(QemuTarget, self).deploy()
def start(self, params=None):
if self.runner.start(params):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
self.stop()
raise bb.build.FuncFailed("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
def stop(self):
self.runner.stop()
self.connection = None
self.ip = None
self.server_ip = None
def restart(self, params=None):
if self.runner.restart(params):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
raise bb.build.FuncFailed("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
示例2: QemuTarget
# 需要导入模块: from oeqa.utils.qemurunner import QemuRunner [as 别名]
# 或者: from oeqa.utils.qemurunner.QemuRunner import restart [as 别名]
#.........这里部分代码省略.........
if d.getVar('FIND_ROOTFS') == '1':
self.image_fstype = image_fstype or self.get_image_fstype(d)
self.rootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), d.getVar("IMAGE_LINK_NAME") + '.' + self.image_fstype)
self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin')
self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
dump_target_cmds = d.getVar("testimage_dump_target")
dump_host_cmds = d.getVar("testimage_dump_host")
dump_dir = d.getVar("TESTIMAGE_DUMP_DIR")
qemu_use_kvm = d.getVar("QEMU_USE_KVM")
if qemu_use_kvm and \
(oe.types.boolean(qemu_use_kvm) and "x86" in d.getVar("MACHINE") or \
d.getVar("MACHINE") in qemu_use_kvm.split()):
use_kvm = True
else:
use_kvm = False
# Log QemuRunner log output to a file
import oe.path
bb.utils.mkdirhier(self.testdir)
self.qemurunnerlog = os.path.join(self.testdir, 'qemurunner_log.%s' % self.datetime)
loggerhandler = logging.FileHandler(self.qemurunnerlog)
loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
self.logger.addHandler(loggerhandler)
oe.path.symlink(os.path.basename(self.qemurunnerlog), os.path.join(self.testdir, 'qemurunner_log'), force=True)
if d.getVar("DISTRO") == "poky-tiny":
self.runner = QemuTinyRunner(machine=d.getVar("MACHINE"),
rootfs=self.rootfs,
tmpdir = d.getVar("TMPDIR"),
deploy_dir_image = d.getVar("DEPLOY_DIR_IMAGE"),
display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY"),
logfile = self.qemulog,
kernel = self.kernel,
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")),
logger = logger)
else:
self.runner = QemuRunner(machine=d.getVar("MACHINE"),
rootfs=self.rootfs,
tmpdir = d.getVar("TMPDIR"),
deploy_dir_image = d.getVar("DEPLOY_DIR_IMAGE"),
display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY"),
logfile = self.qemulog,
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")),
use_kvm = use_kvm,
dump_dir = dump_dir,
dump_host_cmds = d.getVar("testimage_dump_host"),
logger = logger)
self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner)
def deploy(self):
bb.utils.mkdirhier(self.testdir)
qemuloglink = os.path.join(self.testdir, "qemu_boot_log")
if os.path.islink(qemuloglink):
os.unlink(qemuloglink)
os.symlink(self.qemulog, qemuloglink)
self.logger.info("rootfs file: %s" % self.rootfs)
self.logger.info("Qemu log file: %s" % self.qemulog)
super(QemuTarget, self).deploy()
def start(self, params=None, ssh=True, extra_bootparams='', runqemuparams='', launch_cmd='', discard_writes=True):
if launch_cmd:
start = self.runner.launch(get_ip=ssh, launch_cmd=launch_cmd)
else:
start = self.runner.start(params, get_ip=ssh, extra_bootparams=extra_bootparams, runqemuparams=runqemuparams, discard_writes=discard_writes)
if start:
if ssh:
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
self.stop()
if os.path.exists(self.qemulog):
with open(self.qemulog, 'r') as f:
bb.error("Qemu log output from %s:\n%s" % (self.qemulog, f.read()))
raise bb.build.FuncFailed("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
def check(self):
return self.runner.is_alive()
def stop(self):
self.runner.stop()
self.connection = None
self.ip = None
self.server_ip = None
def restart(self, params=None):
if self.runner.restart(params):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
raise bb.build.FuncFailed("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
def run_serial(self, command, timeout=5):
return self.runner.run_serial(command, timeout=timeout)
示例3: QemuTarget
# 需要导入模块: from oeqa.utils.qemurunner import QemuRunner [as 别名]
# 或者: from oeqa.utils.qemurunner.QemuRunner import restart [as 别名]
class QemuTarget(BaseTarget):
supported_image_fstypes = ['ext3', 'ext4', 'cpio.gz']
def __init__(self, d):
super(QemuTarget, self).__init__(d)
self.image_fstype = self.get_image_fstype(d)
self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + '.' + self.image_fstype)
self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.' + self.image_fstype)
self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin')
# Log QemuRunner log output to a file
import oe.path
bb.utils.mkdirhier(self.testdir)
self.qemurunnerlog = os.path.join(self.testdir, 'qemurunner_log.%s' % self.datetime)
logger = logging.getLogger('BitBake.QemuRunner')
loggerhandler = logging.FileHandler(self.qemurunnerlog)
loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
logger.addHandler(loggerhandler)
oe.path.symlink(os.path.basename(self.qemurunnerlog), os.path.join(self.testdir, 'qemurunner_log'), force=True)
if d.getVar("DISTRO", True) == "poky-tiny":
self.runner = QemuTinyRunner(machine=d.getVar("MACHINE", True),
rootfs=self.rootfs,
tmpdir = d.getVar("TMPDIR", True),
deploy_dir_image = d.getVar("DEPLOY_DIR_IMAGE", True),
display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True),
logfile = self.qemulog,
kernel = self.kernel,
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)))
else:
self.runner = QemuRunner(machine=d.getVar("MACHINE", True),
rootfs=self.rootfs,
tmpdir = d.getVar("TMPDIR", True),
deploy_dir_image = d.getVar("DEPLOY_DIR_IMAGE", True),
display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True),
logfile = self.qemulog,
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True)))
def deploy(self):
try:
bb.utils.mkdirhier(self.testdir)
shutil.copyfile(self.origrootfs, self.rootfs)
except Exception as e:
bb.fatal("Error copying rootfs: %s" % e)
qemuloglink = os.path.join(self.testdir, "qemu_boot_log")
if os.path.islink(qemuloglink):
os.unlink(qemuloglink)
os.symlink(self.qemulog, qemuloglink)
bb.note("rootfs file: %s" % self.rootfs)
bb.note("Qemu log file: %s" % self.qemulog)
super(QemuTarget, self).deploy()
def start(self, params=None):
if self.runner.start(params):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
self.stop()
if os.path.exists(self.qemulog):
with open(self.qemulog, 'r') as f:
bb.error("Qemu log output from %s:\n%s" % (self.qemulog, f.read()))
raise bb.build.FuncFailed("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
def stop(self):
self.runner.stop()
self.connection = None
self.ip = None
self.server_ip = None
def restart(self, params=None):
if self.runner.restart(params):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
raise bb.build.FuncFailed("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
def run_serial(self, command):
return self.runner.run_serial(command)