[oe-commits] [openembedded-core] 03/34: logparser: Add decoding ltp logs

git at git.openembedded.org git at git.openembedded.org
Thu Apr 25 11:16:10 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit c950ddcf9720266274451a2841d4370eabd31af6
Author: Armin Kuster <akuster808 at gmail.com>
AuthorDate: Mon Apr 22 06:32:39 2019 -0600

    logparser: Add decoding ltp logs
    
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/utils/logparser.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index 32fde14..76efac4 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -86,3 +86,28 @@ class PtestParser(object):
                     status = self.results[section][test_name]
                     f.write(status + ": " + test_name + "\n")
 
+
+# ltp log parsing
+class LtpParser(object):
+    def __init__(self):
+        self.results = {}
+        self.section = {'duration': "", 'log': ""}
+
+    def parse(self, logfile):
+        test_regex = {}
+        test_regex['PASSED'] = re.compile(r"PASS")
+        test_regex['FAILED'] = re.compile(r"FAIL")
+        test_regex['SKIPPED'] = re.compile(r"SKIP")
+
+        with open(logfile, errors='replace') as f:
+            for line in f:
+                for t in test_regex:
+                    result = test_regex[t].search(line)
+                    if result:
+                        self.results[line.split()[0].strip()] = t
+
+        for test in self.results:
+            result = self.results[test]
+            self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
+
+        return self.results, self.section

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list