diff options
-rw-r--r-- | scripts/lib/resulttool/report.py | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/scripts/lib/resulttool/report.py b/scripts/lib/resulttool/report.py index 692dd7a851..7ceceac802 100644 --- a/scripts/lib/resulttool/report.py +++ b/scripts/lib/resulttool/report.py | |||
@@ -212,7 +212,21 @@ class ResultsTextReport(object): | |||
212 | maxlen=maxlen) | 212 | maxlen=maxlen) |
213 | print(output) | 213 | print(output) |
214 | 214 | ||
215 | def view_test_report(self, logger, source_dir, branch, commit, tag, use_regression_map, raw_test): | 215 | def view_test_report(self, logger, source_dir, branch, commit, tag, use_regression_map, raw_test, selected_test_case_only): |
216 | def print_selected_testcase_result(testresults, selected_test_case_only): | ||
217 | for testsuite in testresults: | ||
218 | for resultid in testresults[testsuite]: | ||
219 | result = testresults[testsuite][resultid]['result'] | ||
220 | test_case_result = result.get(selected_test_case_only, {}) | ||
221 | if test_case_result.get('status'): | ||
222 | print('Found selected test case result for %s from %s' % (selected_test_case_only, | ||
223 | resultid)) | ||
224 | print(test_case_result['status']) | ||
225 | else: | ||
226 | print('Could not find selected test case result for %s from %s' % (selected_test_case_only, | ||
227 | resultid)) | ||
228 | if test_case_result.get('log'): | ||
229 | print(test_case_result['log']) | ||
216 | test_count_reports = [] | 230 | test_count_reports = [] |
217 | configmap = resultutils.store_map | 231 | configmap = resultutils.store_map |
218 | if use_regression_map: | 232 | if use_regression_map: |
@@ -235,12 +249,18 @@ class ResultsTextReport(object): | |||
235 | for testsuite in testresults: | 249 | for testsuite in testresults: |
236 | result = testresults[testsuite].get(raw_test, {}) | 250 | result = testresults[testsuite].get(raw_test, {}) |
237 | if result: | 251 | if result: |
238 | raw_results[testsuite] = result | 252 | raw_results[testsuite] = {raw_test: result} |
239 | if raw_results: | 253 | if raw_results: |
240 | print(json.dumps(raw_results, sort_keys=True, indent=4)) | 254 | if selected_test_case_only: |
255 | print_selected_testcase_result(raw_results, selected_test_case_only) | ||
256 | else: | ||
257 | print(json.dumps(raw_results, sort_keys=True, indent=4)) | ||
241 | else: | 258 | else: |
242 | print('Could not find raw test result for %s' % raw_test) | 259 | print('Could not find raw test result for %s' % raw_test) |
243 | return 0 | 260 | return 0 |
261 | if selected_test_case_only: | ||
262 | print_selected_testcase_result(testresults, selected_test_case_only) | ||
263 | return 0 | ||
244 | for testsuite in testresults: | 264 | for testsuite in testresults: |
245 | for resultid in testresults[testsuite]: | 265 | for resultid in testresults[testsuite]: |
246 | skip = False | 266 | skip = False |
@@ -268,7 +288,7 @@ class ResultsTextReport(object): | |||
268 | def report(args, logger): | 288 | def report(args, logger): |
269 | report = ResultsTextReport() | 289 | report = ResultsTextReport() |
270 | report.view_test_report(logger, args.source_dir, args.branch, args.commit, args.tag, args.use_regression_map, | 290 | report.view_test_report(logger, args.source_dir, args.branch, args.commit, args.tag, args.use_regression_map, |
271 | args.raw_test_only) | 291 | args.raw_test_only, args.selected_test_case_only) |
272 | return 0 | 292 | return 0 |
273 | 293 | ||
274 | def register_commands(subparsers): | 294 | def register_commands(subparsers): |
@@ -287,4 +307,7 @@ def register_commands(subparsers): | |||
287 | help='instead of the default "store_map", use the "regression_map" for report') | 307 | help='instead of the default "store_map", use the "regression_map" for report') |
288 | parser_build.add_argument('-r', '--raw_test_only', default='', | 308 | parser_build.add_argument('-r', '--raw_test_only', default='', |
289 | help='output raw test result only for the user provided test result id') | 309 | help='output raw test result only for the user provided test result id') |
290 | 310 | parser_build.add_argument('-s', '--selected_test_case_only', default='', | |
311 | help='output selected test case result for the user provided test case id, if both test ' | ||
312 | 'result id and test case id are provided then output the selected test case result ' | ||
313 | 'from the provided test result id') | ||