summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/resulttool/report.py42
-rw-r--r--scripts/lib/resulttool/template/test_report_full_text.txt17
2 files changed, 58 insertions, 1 deletions
diff --git a/scripts/lib/resulttool/report.py b/scripts/lib/resulttool/report.py
index 2a749459b4..b9a8903f4c 100644
--- a/scripts/lib/resulttool/report.py
+++ b/scripts/lib/resulttool/report.py
@@ -24,6 +24,7 @@ class ResultsTextReport(object):
24 def __init__(self): 24 def __init__(self):
25 self.ptests = {} 25 self.ptests = {}
26 self.ltptests = {} 26 self.ltptests = {}
27 self.ltpposixtests = {}
27 self.result_types = {'passed': ['PASSED', 'passed'], 28 self.result_types = {'passed': ['PASSED', 'passed'],
28 'failed': ['FAILED', 'failed', 'ERROR', 'error', 'UNKNOWN'], 29 'failed': ['FAILED', 'failed', 'ERROR', 'error', 'UNKNOWN'],
29 'skipped': ['SKIPPED', 'skipped']} 30 'skipped': ['SKIPPED', 'skipped']}
@@ -88,6 +89,37 @@ class ResultsTextReport(object):
88 if status in self.result_types[tk]: 89 if status in self.result_types[tk]:
89 self.ltptests[suite][tk] += 1 90 self.ltptests[suite][tk] += 1
90 91
92 def handle_ltpposixtest_result(self, k, status, result):
93 if k == 'ltpposixresult.sections':
94 # Ensure tests without any test results still show up on the report
95 for suite in result['ltpposixresult.sections']:
96 if suite not in self.ltpposixtests:
97 self.ltpposixtests[suite] = {'passed': 0, 'failed': 0, 'skipped': 0, 'duration' : '-', 'failed_testcases': []}
98 if 'duration' in result['ltpposixresult.sections'][suite]:
99 self.ltpposixtests[suite]['duration'] = result['ltpposixresult.sections'][suite]['duration']
100 return
101 try:
102 _, suite, test = k.split(".", 2)
103 except ValueError:
104 return
105 # Handle 'glib-2.0'
106 if 'ltpposixresult.sections' in result and suite not in result['ltpposixresult.sections']:
107 try:
108 _, suite, suite1, test = k.split(".", 3)
109 if suite + "." + suite1 in result['ltpposixresult.sections']:
110 suite = suite + "." + suite1
111 except ValueError:
112 pass
113 if suite not in self.ltpposixtests:
114 self.ltpposixtests[suite] = {'passed': 0, 'failed': 0, 'skipped': 0, 'duration' : '-', 'failed_testcases': []}
115 for tk in self.result_types:
116 if status in self.result_types[tk]:
117 self.ltpposixtests[suite][tk] += 1
118
119 def get_aggregated_test_result(self, logger, testresult):
120 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}
121 def get_aggregated_test_result(self, logger, testresult):
122 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}
91 def get_aggregated_test_result(self, logger, testresult): 123 def get_aggregated_test_result(self, logger, testresult):
92 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []} 124 test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}
93 def get_aggregated_test_result(self, logger, testresult): 125 def get_aggregated_test_result(self, logger, testresult):
@@ -104,6 +136,8 @@ class ResultsTextReport(object):
104 self.handle_ptest_result(k, test_status, result) 136 self.handle_ptest_result(k, test_status, result)
105 if k.startswith("ltpresult."): 137 if k.startswith("ltpresult."):
106 self.handle_ltptest_result(k, test_status, result) 138 self.handle_ltptest_result(k, test_status, result)
139 if k.startswith("ltpposixresult."):
140 self.handle_ltpposixtest_result(k, test_status, result)
107 return test_count_report 141 return test_count_report
108 142
109 def print_test_report(self, template_file_name, test_count_reports): 143 def print_test_report(self, template_file_name, test_count_reports):
@@ -115,9 +149,10 @@ class ResultsTextReport(object):
115 havefailed = False 149 havefailed = False
116 haveptest = bool(self.ptests) 150 haveptest = bool(self.ptests)
117 haveltp = bool(self.ltptests) 151 haveltp = bool(self.ltptests)
152 haveltpposix = bool(self.ltpposixtests)
118 reportvalues = [] 153 reportvalues = []
119 cols = ['passed', 'failed', 'skipped'] 154 cols = ['passed', 'failed', 'skipped']
120 maxlen = {'passed' : 0, 'failed' : 0, 'skipped' : 0, 'result_id': 0, 'testseries' : 0, 'ptest' : 0 ,'ltptest': 0} 155 maxlen = {'passed' : 0, 'failed' : 0, 'skipped' : 0, 'result_id': 0, 'testseries' : 0, 'ptest' : 0 ,'ltptest': 0, 'ltpposixtest': 0}
121 for line in test_count_reports: 156 for line in test_count_reports:
122 total_tested = line['passed'] + line['failed'] + line['skipped'] 157 total_tested = line['passed'] + line['failed'] + line['skipped']
123 vals = {} 158 vals = {}
@@ -139,12 +174,17 @@ class ResultsTextReport(object):
139 for ltptest in self.ltptests: 174 for ltptest in self.ltptests:
140 if len(ltptest) > maxlen['ltptest']: 175 if len(ltptest) > maxlen['ltptest']:
141 maxlen['ltptest'] = len(ltptest) 176 maxlen['ltptest'] = len(ltptest)
177 for ltpposixtest in self.ltpposixtests:
178 if len(ltpposixtest) > maxlen['ltpposixtest']:
179 maxlen['ltpposixtest'] = len(ltpposixtest)
142 output = template.render(reportvalues=reportvalues, 180 output = template.render(reportvalues=reportvalues,
143 havefailed=havefailed, 181 havefailed=havefailed,
144 haveptest=haveptest, 182 haveptest=haveptest,
145 ptests=self.ptests, 183 ptests=self.ptests,
146 haveltp=haveltp, 184 haveltp=haveltp,
185 haveltpposix=haveltpposix,
147 ltptests=self.ltptests, 186 ltptests=self.ltptests,
187 ltpposixtests=self.ltpposixtests,
148 maxlen=maxlen) 188 maxlen=maxlen)
149 print(output) 189 print(output)
150 190
diff --git a/scripts/lib/resulttool/template/test_report_full_text.txt b/scripts/lib/resulttool/template/test_report_full_text.txt
index 6ecd5bce59..d2725b8d01 100644
--- a/scripts/lib/resulttool/template/test_report_full_text.txt
+++ b/scripts/lib/resulttool/template/test_report_full_text.txt
@@ -41,6 +41,23 @@ Ltp Test Result Summary
41There was no LTP Test data 41There was no LTP Test data
42{% endif %} 42{% endif %}
43 43
44{% if haveltpposix %}
45==============================================================================================================
46Ltp Posix Result Summary
47==============================================================================================================
48--------------------------------------------------------------------------------------------------------------
49{{ 'Recipe'.ljust(maxlen['ltpposixtest']) }} | {{ 'Passed'.ljust(maxlen['passed']) }} | {{ 'Failed'.ljust(maxlen['failed']) }} | {{ 'Skipped'.ljust(maxlen['skipped']) }} | {{ 'Time(s)'.ljust(10) }}
50--------------------------------------------------------------------------------------------------------------
51{% for ltpposixtest in ltpposixtests |sort %}
52{{ ltpposixtest.ljust(maxlen['ltpposixtest']) }} | {{ (ltpposixtests[ltpposixtest]['passed']|string).ljust(maxlen['passed']) }} | {{ (ltpposixtests[ltpposixtest]['failed']|string).ljust(maxlen['failed']) }} | {{ (ltpposixtests[ltpposixtest]['skipped']|string).ljust(maxlen['skipped']) }} | {{ (ltpposixtests[ltpposixtest]['duration']|string) }}
53{% endfor %}
54--------------------------------------------------------------------------------------------------------------
55
56{% else %}
57There was no LTP Posix Test data
58{% endif %}
59
60
44 61
45============================================================================================================== 62==============================================================================================================
46Failed test cases (sorted by testseries, ID) 63Failed test cases (sorted by testseries, ID)