summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/logparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/logparser.py')
-rw-r--r--meta/lib/oeqa/utils/logparser.py36
1 files changed, 16 insertions, 20 deletions
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index 328baeefaf..0807093fda 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -6,35 +6,31 @@ import re
6from . import ftools 6from . import ftools
7 7
8# A parser that can be used to identify weather a line is a test result or a section statement. 8# A parser that can be used to identify weather a line is a test result or a section statement.
9class Lparser(object): 9class PtestParser(object):
10 10
11 def __init__(self, **kwargs): 11 def __init__(self):
12 12
13 self.test_regex = {} 13 self.test_regex = {}
14 self.test_regex[0] = {} 14 self.test_regex['pass'] = re.compile(r"^PASS:(.+)")
15 self.test_regex[0]['pass'] = re.compile(r"^PASS:(.+)") 15 self.test_regex['fail'] = re.compile(r"^FAIL:(.+)")
16 self.test_regex[0]['fail'] = re.compile(r"^FAIL:(.+)") 16 self.test_regex['skip'] = re.compile(r"^SKIP:(.+)")
17 self.test_regex[0]['skip'] = re.compile(r"^SKIP:(.+)")
18 17
19 self.section_regex = {} 18 self.section_regex = {}
20 self.section_regex[0] = {} 19 self.section_regex['begin'] = re.compile(r"^BEGIN: .*/(.+)/ptest")
21 self.section_regex[0]['begin'] = re.compile(r"^BEGIN: .*/(.+)/ptest") 20 self.section_regex['end'] = re.compile(r"^END: .*/(.+)/ptest")
22 self.section_regex[0]['end'] = re.compile(r"^END: .*/(.+)/ptest")
23 21
24 # Parse a line and return a tuple containing the type of result (test/section) and its category, status and name 22 # Parse a line and return a tuple containing the type of result (test/section) and its category, status and name
25 def parse_line(self, line): 23 def parse_line(self, line):
26 24
27 for test_category, test_status_list in self.test_regex.items(): 25 for test_status, status_regex in test_status_list.items():
28 for test_status, status_regex in test_status_list.items(): 26 test_name = status_regex.search(line)
29 test_name = status_regex.search(line) 27 if test_name:
30 if test_name: 28 return ['test', test_category, test_status, test_name.group(1)]
31 return ['test', test_category, test_status, test_name.group(1)] 29
32 30 for section_status, status_regex in section_status_list.items():
33 for section_category, section_status_list in self.section_regex.items(): 31 section_name = status_regex.search(line)
34 for section_status, status_regex in section_status_list.items(): 32 if section_name:
35 section_name = status_regex.search(line) 33 return ['section', section_category, section_status, section_name.group(1)]
36 if section_name:
37 return ['section', section_category, section_status, section_name.group(1)]
38 return None 34 return None
39 35
40 36