]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runqemu: Only show stdout/stderr upon test failure
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 8 Nov 2017 14:03:28 +0000 (14:03 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 9 Nov 2017 11:49:13 +0000 (11:49 +0000)
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/core/runner.py
meta/lib/oeqa/selftest/cases/runqemu.py

index f6539e60b6bb28e13bb909063b37b074a199c7e6..2d756da6d01c1db7ea6b6290e43dbca74a63fd8b 100644 (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
index 1991be7d0c52067fba86f47e046e89f4d38e5003..1a8d12178d70926d06a01b30b81593d8408d3d56 100644 (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()