sanitycheck: allow QEMU to crash without failing
Adds some code to allow QEMU to crash without failing the test. This is required for testing coredump code as it will certainly cause QEMU to crash. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
5b1b4a3755
commit
faae15d838
|
@ -762,6 +762,13 @@ class QEMUHandler(Handler):
|
|||
|
||||
self.pid_fn = os.path.join(instance.build_dir, "qemu.pid")
|
||||
|
||||
if "ignore_qemu_crash" in instance.testcase.tags:
|
||||
self.ignore_qemu_crash = True
|
||||
self.ignore_unexpected_eof = True
|
||||
else:
|
||||
self.ignore_qemu_crash = False
|
||||
self.ignore_unexpected_eof = False
|
||||
|
||||
@staticmethod
|
||||
def _get_cpu_time(pid):
|
||||
"""get process CPU time.
|
||||
|
@ -775,7 +782,8 @@ class QEMUHandler(Handler):
|
|||
return cpu_time.user + cpu_time.system
|
||||
|
||||
@staticmethod
|
||||
def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, results, harness):
|
||||
def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, results, harness,
|
||||
ignore_unexpected_eof=False):
|
||||
fifo_in = fifo_fn + ".in"
|
||||
fifo_out = fifo_fn + ".out"
|
||||
|
||||
|
@ -840,6 +848,7 @@ class QEMUHandler(Handler):
|
|||
|
||||
if c == "":
|
||||
# EOF, this shouldn't happen unless QEMU crashes
|
||||
if not ignore_unexpected_eof:
|
||||
out_state = "unexpected eof"
|
||||
break
|
||||
line = line + c
|
||||
|
@ -925,7 +934,8 @@ class QEMUHandler(Handler):
|
|||
self.thread = threading.Thread(name=self.name, target=QEMUHandler._thread,
|
||||
args=(self, self.timeout, self.build_dir,
|
||||
self.log_fn, self.fifo_fn,
|
||||
self.pid_fn, self.results, harness))
|
||||
self.pid_fn, self.results, harness,
|
||||
self.ignore_unexpected_eof))
|
||||
|
||||
self.instance.results = harness.tests
|
||||
self.thread.daemon = True
|
||||
|
@ -974,7 +984,7 @@ class QEMUHandler(Handler):
|
|||
|
||||
logger.debug(f"return code from qemu: {self.returncode}")
|
||||
|
||||
if self.returncode != 0 or not harness.state:
|
||||
if (self.returncode != 0 and not self.ignore_qemu_crash) or not harness.state:
|
||||
self.set_state("failed", 0)
|
||||
self.instance.reason = "Exited with {}".format(self.returncode)
|
||||
|
||||
|
|
Loading…
Reference in a new issue