summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2020-01-31 13:47:42 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-13 12:19:14 +0000
commit0b032d39fa3c90d60c326c5568dcd1b3ac65aaa1 (patch)
treee896f9d8012d858ed642c4dcf9e75e498e60e191
parentac467533f0b839237c5d31ce84102d28283f99dd (diff)
downloadpoky-0b032d39fa3c90d60c326c5568dcd1b3ac65aaa1.tar.gz
scripts/lib/resulttool/report: Enable report selected test case result
Enable reporting selected test case result given the user provided the selected test case id. If both test result id and test case id were provided, report the selected test case result from the selected test result id. (From OE-Core rev: 7161310ce32d6e0c397d0132808d556bdc80d183) Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/resulttool/report.py33
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):
268def report(args, logger): 288def 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
274def register_commands(subparsers): 294def 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')