[OE-core] [PATCH] oeqa/testimage: Enhance -v switch in testimage

Lucian Musat george.l.musat at intel.com
Tue Sep 15 13:52:44 UTC 2015


When testimage is run with -v switch now individual
test progress can be seen directly in bitbake console.

[YOCTO #6841]

Signed-off-by: Lucian Musat <george.l.musat at intel.com>
---
 meta/lib/oeqa/oetest.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 0fe68d4..99da20d 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -106,6 +106,17 @@ def loadTests(tc, type="runtime"):
     suites.sort(cmp=lambda a,b: cmp((a.depth, a.index), (b.depth, b.index)))
     return testloader.suiteClass(suites)
 
+_buffer = ""
+
+def custom_verbose(msg, *args, **kwargs):
+    global _buffer
+    if msg[-1] != "\n":
+        _buffer += msg
+    else:
+        _buffer += msg
+        bb.plain(_buffer.rstrip("\n"), *args, **kwargs)
+        _buffer = ""
+
 def runTests(tc, type="runtime"):
 
     suite = loadTests(tc, type)
@@ -114,6 +125,8 @@ def runTests(tc, type="runtime"):
         bb.note("Filter test cases by tags: %s" % tc.tagexp)
     bb.note("Found %s tests" % suite.countTestCases())
     runner = unittest.TextTestRunner(verbosity=2)
+    if bb.msg.loggerDefaultVerbose:
+        runner.stream.write = custom_verbose
     result = runner.run(suite)
 
     return result
-- 
2.1.4




More information about the Openembedded-core mailing list