testimage: performance improvements

Refactored processing of QEMU logs.
The original code read QEMU logs every 30 seconds, which
resulted in each test taking at least 30 seconds to finish.
In reality, most tests take only a few seconds.
Although the tests run in parallel, on systems with only a few
CPUs this can make a very noticable difference.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
This commit is contained in:
Juro Bystricky
2017-02-05 20:14:29 -08:00
parent c42423e291
commit 32e3cf773e
4 changed files with 123 additions and 101 deletions

View File

@@ -5,19 +5,25 @@ class ZephyrTest(oeRuntimeTest):
def test_boot_zephyr(self):
success = False
logfile = self.target.wait_for_serial(180, 30)
logfile = self.target.qemurunnerlog
while True:
line = self.target.serial_readline().decode("utf-8")
with open(logfile) as f:
for line in f:
# All good
if "PROJECT EXECUTION SUCCESSFUL" in line:
success = True
break
# Most likely cause for faults is incorrectly compiled code
if "***** USAGE FAULT *****" in line:
success = False
self.assertTrue(success, msg='***** USAGE FAULT *****" in file:///%s' % logfile)
break
# All good
if "PROJECT EXECUTION SUCCESSFUL" in line:
success = True
break
if "PROJECT EXECUTION FAILED" in line:
success = False
self.assertTrue(success, msg='PROJECT EXECUTION FAILED in file:///%s' % logfile)
break
# Most likely cause for faults is incorrectly compiled code
if "***** USAGE FAULT *****" in line:
success = False
self.assertTrue(success, msg='***** USAGE FAULT *****" in file:///%s' % logfile)
break
# test program finished, complain if no success message
self.assertTrue(success, msg='"PROJECT EXECUTION SUCCESSFUL" not in file:///%s' % logfile)