summaryrefslogtreecommitdiffstats
path: root/scripts/lib/resulttool/report.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/resulttool/report.py')
-rw-r--r--scripts/lib/resulttool/report.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/scripts/lib/resulttool/report.py b/scripts/lib/resulttool/report.py
index a98f2393e6..cb6b1cf948 100644
--- a/scripts/lib/resulttool/report.py
+++ b/scripts/lib/resulttool/report.py
@@ -18,6 +18,7 @@ class ResultsTextReport(object):
18 def __init__(self): 18 def __init__(self):
19 self.ptests = {} 19 self.ptests = {}
20 self.ltptests = {} 20 self.ltptests = {}
21 self.ltpposixtests = {}
21 self.result_types = {'passed': ['PASSED', 'passed'], 22 self.result_types = {'passed': ['PASSED', 'passed'],
22 'failed': ['FAILED', 'failed', 'ERROR', 'error', 'UNKNOWN'], 23 'failed': ['FAILED', 'failed', 'ERROR', 'error', 'UNKNOWN'],
23 'skipped': ['SKIPPED', 'skipped']} 24 'skipped': ['SKIPPED', 'skipped']}
@@ -82,6 +83,37 @@ class ResultsTextReport(object):
82 if status in self.result_types[tk]: 83 if status in self.result_types[tk]:
83 self.ltptests[suite][tk] += 1 84 self.ltptests[suite][tk] += 1
84 85
86 def handle_ltpposixtest_result(self, k, status, result):
87 if k == 'ltpposixresult.sections':
88 # Ensure tests without any test results still show up on the report
89 for suite in result['ltpposixresult.sections']:
90 if suite not in self.ltpposixtests:
91 self.ltpposixtests[suite] = {'passed': 0, 'failed': 0, 'skipped': 0, 'duration' : '-', 'failed_testcases': []}
92 if 'duration' in result['ltpposixresult.sections'][suite]:
93 self.ltpposixtests[suite]['duration'] = result['ltpposixresult.sections'][suite]['duration']
94 return
95 try:
96 _, suite, test = k.split(".", 2)
97 except ValueError:
98 return
99 # Handle 'glib-2.0'
100 if 'ltpposixresult.sections' in result and suite not in result['ltpposixresult.sections']:
101 try:
102 _, suite, suite1, test = k.split(".", 3)
103 if suite + "." + suite1 in result['ltpposixresult.sections']:
104 suite = suite + "." + suite1
105 except ValueError:
106 pass
107 if suite not in self.ltpposixtests:
108 self.ltpposixtests[suite] = {'passed': 0, 'failed': 0, 'skipped': 0, 'duration' : '-', 'failed_testcases': []}
109 for tk in self.result_types:
110 if status in self.result_types[tk]:
111 self.ltpposixtests[suite][tk] += 1
112
113 def get_aggregated_test_result(self, logger, testresult):
114 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}
115 def get_aggregated_test_result(self, logger, testresult):
116 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}
85 def get_aggregated_test_result(self, logger, testresult): 117 def get_aggregated_test_result(self, logger, testresult):
86 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []} 118 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}
87 def get_aggregated_test_result(self, logger, testresult): 119 def get_aggregated_test_result(self, logger, testresult):
@@ -98,6 +130,8 @@ class ResultsTextReport(object):
98 self.handle_ptest_result(k, test_status, result) 130 self.handle_ptest_result(k, test_status, result)
99 if k.startswith("ltpresult."): 131 if k.startswith("ltpresult."):
100 self.handle_ltptest_result(k, test_status, result) 132 self.handle_ltptest_result(k, test_status, result)
133 if k.startswith("ltpposixresult."):
134 self.handle_ltpposixtest_result(k, test_status, result)
101 return test_count_report 135 return test_count_report
102 136
103 def print_test_report(self, template_file_name, test_count_reports): 137 def print_test_report(self, template_file_name, test_count_reports):
@@ -109,9 +143,10 @@ class ResultsTextReport(object):
109 havefailed = False 143 havefailed = False
110 haveptest = bool(self.ptests) 144 haveptest = bool(self.ptests)
111 haveltp = bool(self.ltptests) 145 haveltp = bool(self.ltptests)
146 haveltpposix = bool(self.ltpposixtests)
112 reportvalues = [] 147 reportvalues = []
113 cols = ['passed', 'failed', 'skipped'] 148 cols = ['passed', 'failed', 'skipped']
114 maxlen = {'passed' : 0, 'failed' : 0, 'skipped' : 0, 'result_id': 0, 'testseries' : 0, 'ptest' : 0 ,'ltptest': 0} 149 maxlen = {'passed' : 0, 'failed' : 0, 'skipped' : 0, 'result_id': 0, 'testseries' : 0, 'ptest' : 0 ,'ltptest': 0, 'ltpposixtest': 0}
115 for line in test_count_reports: 150 for line in test_count_reports:
116 total_tested = line['passed'] + line['failed'] + line['skipped'] 151 total_tested = line['passed'] + line['failed'] + line['skipped']
117 vals = {} 152 vals = {}
@@ -133,12 +168,17 @@ class ResultsTextReport(object):
133 for ltptest in self.ltptests: 168 for ltptest in self.ltptests:
134 if len(ltptest) > maxlen['ltptest']: 169 if len(ltptest) > maxlen['ltptest']:
135 maxlen['ltptest'] = len(ltptest) 170 maxlen['ltptest'] = len(ltptest)
171 for ltpposixtest in self.ltpposixtests:
172 if len(ltpposixtest) > maxlen['ltpposixtest']:
173 maxlen['ltpposixtest'] = len(ltpposixtest)
136 output = template.render(reportvalues=reportvalues, 174 output = template.render(reportvalues=reportvalues,
137 havefailed=havefailed, 175 havefailed=havefailed,
138 haveptest=haveptest, 176 haveptest=haveptest,
139 ptests=self.ptests, 177 ptests=self.ptests,
140 haveltp=haveltp, 178 haveltp=haveltp,
179 haveltpposix=haveltpposix,
141 ltptests=self.ltptests, 180 ltptests=self.ltptests,
181 ltpposixtests=self.ltpposixtests,
142 maxlen=maxlen) 182 maxlen=maxlen)
143 print(output) 183 print(output)
144 184