sanitycheck: capture delayed faults

Do not close console after PASS is reported, wait a bit for any
remaining messages from the tests, sometimes we have faults that need to
be parsed.
This now works for Qemu handler, support for other handlers to follow.

Fixes #9646

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-08-29 01:45:38 -04:00
commit 39ae72b4cb
2 changed files with 19 additions and 4 deletions

View file

@ -64,7 +64,8 @@ class Test(Harness):
"MPU FAULT",
"Kernel Panic",
"Kernel OOPS",
"BUS FAULT"
"BUS FAULT",
"CPU Page Fault"
]
def handle(self, line):

View file

@ -526,13 +526,15 @@ class QEMUHandler(Handler):
timeout_time = start_time + timeout
p = select.poll()
p.register(in_fp, select.POLLIN)
out_state = None
metrics = {}
line = ""
while True:
this_timeout = int((timeout_time - time.time()) * 1000)
if this_timeout < 0 or not p.poll(this_timeout):
out_state = "timeout"
if not out_state:
out_state = "timeout"
break
try:
@ -558,8 +560,20 @@ class QEMUHandler(Handler):
harness.handle(line)
if harness.state:
out_state = harness.state
break
# if we have registered a fail make sure the state is not
# overridden by a false success message coming from the
# testsuite
if out_state != 'failed':
out_state = harness.state
# if we get some state, that means test is doing well, we reset
# the timeout and wait for 5 more seconds just in case we have
# crashed after test has completed
if harness.type:
break
else:
timeout_time = time.time() + 2
# TODO: Add support for getting numerical performance data
# from test cases. Will involve extending test case reporting