summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-22 06:32:39 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-18 11:28:58 +0100
commit2b408be15757749d9aa41b7c8082316489f79772 (patch)
tree393c6d979a9a8f51d8e96bad6c62068cb4c6bb61 /meta
parentcd00120aea0d2ddc08f2cb2de950bca1052b172e (diff)
downloadpoky-2b408be15757749d9aa41b7c8082316489f79772.tar.gz
logparser: Add decoding ltp logs
(From OE-Core rev: 8c0a03c24248bf69e9c8c0f2d949ff79efc9c71e) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/utils/logparser.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index 18285fb544..abff8c78ae 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -89,3 +89,28 @@ class PtestParser(object):
89 status = self.results[section][test_name] 89 status = self.results[section][test_name]
90 f.write(status + ": " + test_name + "\n") 90 f.write(status + ": " + test_name + "\n")
91 91
92
93# ltp log parsing
94class LtpParser(object):
95 def __init__(self):
96 self.results = {}
97 self.section = {'duration': "", 'log': ""}
98
99 def parse(self, logfile):
100 test_regex = {}
101 test_regex['PASSED'] = re.compile(r"PASS")
102 test_regex['FAILED'] = re.compile(r"FAIL")
103 test_regex['SKIPPED'] = re.compile(r"SKIP")
104
105 with open(logfile, errors='replace') as f:
106 for line in f:
107 for t in test_regex:
108 result = test_regex[t].search(line)
109 if result:
110 self.results[line.split()[0].strip()] = t
111
112 for test in self.results:
113 result = self.results[test]
114 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
115
116 return self.results, self.section