sanitycheck: handle qemu crashes
Deal with qemu crashes and do not register pass status as the default. In case we do not have a status, report unknown. This now captures different states from qemu that were not captured before. Fixes #26679 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
b15bec5a2a
commit
869ca055c5
1 changed files with 17 additions and 2 deletions
|
@ -814,7 +814,7 @@ class QEMUHandler(Handler):
|
||||||
# if we have registered a fail make sure the state is not
|
# if we have registered a fail make sure the state is not
|
||||||
# overridden by a false success message coming from the
|
# overridden by a false success message coming from the
|
||||||
# testsuite
|
# testsuite
|
||||||
if out_state != 'failed':
|
if out_state not in ['failed', 'unexpected eof', 'unexpected byte']:
|
||||||
out_state = harness.state
|
out_state = harness.state
|
||||||
|
|
||||||
# if we get some state, that means test is doing well, we reset
|
# if we get some state, that means test is doing well, we reset
|
||||||
|
@ -828,6 +828,8 @@ class QEMUHandler(Handler):
|
||||||
timeout_time = time.time() + 30
|
timeout_time = time.time() + 30
|
||||||
else:
|
else:
|
||||||
timeout_time = time.time() + 2
|
timeout_time = time.time() + 2
|
||||||
|
else:
|
||||||
|
logger.debug("got nothing from harness")
|
||||||
line = ""
|
line = ""
|
||||||
|
|
||||||
handler.record(harness)
|
handler.record(harness)
|
||||||
|
@ -835,11 +837,16 @@ class QEMUHandler(Handler):
|
||||||
handler_time = time.time() - start_time
|
handler_time = time.time() - start_time
|
||||||
logger.debug("QEMU complete (%s) after %f seconds" %
|
logger.debug("QEMU complete (%s) after %f seconds" %
|
||||||
(out_state, handler_time))
|
(out_state, handler_time))
|
||||||
|
|
||||||
handler.set_state(out_state, handler_time)
|
handler.set_state(out_state, handler_time)
|
||||||
|
|
||||||
if out_state == "timeout":
|
if out_state == "timeout":
|
||||||
handler.instance.reason = "Timeout"
|
handler.instance.reason = "Timeout"
|
||||||
elif out_state == "failed":
|
elif out_state == "failed":
|
||||||
handler.instance.reason = "Failed"
|
handler.instance.reason = "Failed"
|
||||||
|
elif out_state in ['unexpected eof', 'unexpected byte']:
|
||||||
|
handler.set_state("failed", handler_time)
|
||||||
|
handler.instance.reason = out_state
|
||||||
|
|
||||||
log_out_fp.close()
|
log_out_fp.close()
|
||||||
out_fp.close()
|
out_fp.close()
|
||||||
|
@ -911,11 +918,15 @@ class QEMUHandler(Handler):
|
||||||
proc.kill()
|
proc.kill()
|
||||||
self.returncode = proc.returncode
|
self.returncode = proc.returncode
|
||||||
else:
|
else:
|
||||||
|
logger.debug(f"No timeout, return code from qemu: {self.returncode}")
|
||||||
self.returncode = proc.returncode
|
self.returncode = proc.returncode
|
||||||
|
|
||||||
if os.path.exists(self.pid_fn):
|
if os.path.exists(self.pid_fn):
|
||||||
os.unlink(self.pid_fn)
|
os.unlink(self.pid_fn)
|
||||||
|
|
||||||
|
|
||||||
|
logger.debug(f"return code from qemu: {self.returncode}")
|
||||||
|
|
||||||
if self.returncode != 0:
|
if self.returncode != 0:
|
||||||
self.set_state("failed", 0)
|
self.set_state("failed", 0)
|
||||||
self.instance.reason = "Exited with {}".format(self.returncode)
|
self.instance.reason = "Exited with {}".format(self.returncode)
|
||||||
|
@ -2013,6 +2024,7 @@ class ProjectBuilder(FilterBuilder):
|
||||||
logger.debug("run test: %s" % self.instance.name)
|
logger.debug("run test: %s" % self.instance.name)
|
||||||
self.run()
|
self.run()
|
||||||
self.instance.status, _ = self.instance.handler.get_state()
|
self.instance.status, _ = self.instance.handler.get_state()
|
||||||
|
logger.debug(f"run status: {self.instance.status}")
|
||||||
pipeline.put({
|
pipeline.put({
|
||||||
"op": "report",
|
"op": "report",
|
||||||
"test": self.instance,
|
"test": self.instance,
|
||||||
|
@ -2082,8 +2094,11 @@ class ProjectBuilder(FilterBuilder):
|
||||||
elif instance.status == "skipped":
|
elif instance.status == "skipped":
|
||||||
self.suite.total_skipped += 1
|
self.suite.total_skipped += 1
|
||||||
status = Fore.YELLOW + "SKIPPED" + Fore.RESET
|
status = Fore.YELLOW + "SKIPPED" + Fore.RESET
|
||||||
else:
|
elif instance.status == "passed":
|
||||||
status = Fore.GREEN + "PASSED" + Fore.RESET
|
status = Fore.GREEN + "PASSED" + Fore.RESET
|
||||||
|
else:
|
||||||
|
logger.debug(f"Unknown status = {instance.status}")
|
||||||
|
status = Fore.YELLOW + "UNKNOWN" + Fore.RESET
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
if self.cmake_only:
|
if self.cmake_only:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue