sanitycheck: Relocate QEMU-specific code to QEMUHandler.

This commit relocates the QEMU-specific code that currently resides in
ProjectBuilder.run to QEMUHandler.handle, in order to align with what
other handlers are doing.

For more details, refer to the PR #20573.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2019-11-12 14:11:31 +09:00 committed by Kumar Gala
parent 938890041a
commit e1827c04d3

View File

@ -974,6 +974,19 @@ class QEMUHandler(Handler):
self.thread.start()
subprocess.call(["stty", "sane"])
verbose("Running %s (%s)" %(self.name, self.type_str))
command = [get_generator()[0]]
command += ["-C", self.build_dir, "run"]
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.build_dir) as proc:
verbose("Spawning QEMUHandler Thread for %s" % self.name)
proc.wait()
self.returncode = proc.returncode
if self.returncode != 0:
self.set_state("failed", 0)
self.instance.reason = "Exited with {}".format(self.returncode)
def get_fifo(self):
return self.fifo_fn
@ -2116,20 +2129,6 @@ class ProjectBuilder(FilterBuilder):
instance.handler.handle()
if instance.handler.type_str == "qemu":
verbose("Running %s (%s)" %(instance.name, instance.handler.type_str))
command = [get_generator()[0]]
command += ["-C", self.build_dir, "run"]
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.build_dir) as proc:
verbose("Spawning QEMUHandler Thread for %s" % instance.name)
proc.wait()
self.returncode = proc.returncode
if self.returncode != 0:
instance.handler.set_state("failed", 0)
instance.reason = "Exited with {}".format(self.returncode)
sys.stdout.flush()