Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: patrick.ohly@gmx.de, paul.eggleton@linux.intel.com
Subject: [PATCH 2/2] oeqa/core/runner: OEStreamLogger don't buffer test execution writes
Date: Wed, 26 Jul 2017 10:04:10 -0500	[thread overview]
Message-ID: <20170726150410.5492-2-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <20170726150410.5492-1-anibal.limon@linux.intel.com>

Since OEQA framework uses Python logging functionality to report test
results there is a class that wraps PyUnit writes into logging commands
(OEStreamLogger), so don't buffer the actual test execution to have
insight of what is currently executing.

This fix will change a little the test output format adding an '\n'
previous the test result, for example:

From:

test_nonmatching_checksum (lic_checksum.LicenseTests) ... ok

To:

test_nonmatching_checksum (lic_checksum.LicenseTests)
 ... ok

This is because the new line added by the PyUnit StreamLogger because
currently we don't have a manner to identify when a test execution
starts at report level (write msg).

[YOCTO #11827]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 meta/lib/oeqa/core/runner.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
index 8a55c24c788..f6539e60b6b 100644
--- a/meta/lib/oeqa/core/runner.py
+++ b/meta/lib/oeqa/core/runner.py
@@ -25,10 +25,14 @@ class OEStreamLogger(object):
 
     def write(self, msg):
         if len(msg) > 1 and msg[0] != '\n':
-            self.buffer += msg
-        else:
-            self.logger.log(logging.INFO, self.buffer.rstrip("\n"))
-            self.buffer = ""
+            if '...' in msg:
+                self.buffer += msg
+            elif self.buffer:
+                self.buffer += msg
+                self.logger.log(logging.INFO, self.buffer)
+                self.buffer = ""
+            else:
+                self.logger.log(logging.INFO, msg)
 
     def flush(self):
         for handler in self.logger.handlers:
-- 
2.11.0



      reply	other threads:[~2017-07-26 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 15:04 [PATCH 1/2] oeqa/{core, selftest}: Add support to validate if a specified test case isn't found Aníbal Limón
2017-07-26 15:04 ` Aníbal Limón [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170726150410.5492-2-anibal.limon@linux.intel.com \
    --to=anibal.limon@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=patrick.ohly@gmx.de \
    --cc=paul.eggleton@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox