oeqa/runqemu: Only show stdout/stderr upon test failure

In general we don't need to see the output of runqemu however if it fails
we do. Use the buffer option that already exists in TestResult but allow
us to trigger it on a per test basis.

(From OE-Core rev: 86bef95bccbe9dad3dc3445ea365439861966179)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2017-11-08 14:03:28 +00:00
parent 729b1d3afd
commit a3a122d2f5
2 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,14 @@ class OETestResult(_TestResult):
self.tc = tc
self._tc_map_results()
def startTest(self, test):
# Allow us to trigger the testcase buffer mode on a per test basis
# so stdout/stderr are only printed upon failure. Enables debugging
# but clean output
if hasattr(test, "buffer"):
self.buffer = True
super(OETestResult, self).startTest(test)
def _tc_map_results(self):
self.tc._results['failures'] = self.failures
self.tc._results['errors'] = self.errors

View File

@ -14,6 +14,8 @@ class RunqemuTests(OESelftestTestCase):
image_is_ready = False
deploy_dir_image = ''
# We only want to print runqemu stdout/stderr if there is a test case failure
buffer = True
def setUpLocal(self):
super(RunqemuTests, self).setUpLocal()