|
18 | 18 | import os |
19 | 19 | import shutil |
20 | 20 | import time |
| 21 | +import json |
21 | 22 | import sys |
22 | 23 | import shlex |
23 | 24 | import argparse |
@@ -389,7 +390,13 @@ def run_test(testsuite, avocado_bin): |
389 | 390 | logger.info('') |
390 | 391 | result_link = testsuite.jobdir() |
391 | 392 | if result_link: |
392 | | - result_link += "/job.log" |
| 393 | + result_json = result_link + "/results.json" |
| 394 | + result_link += "/job.log\n" |
| 395 | + with open(result_json, encoding = "utf-8") as fp: |
| 396 | + result_state = json.load(fp) |
| 397 | + for state in ['pass', 'cancel', 'errors', 'failures', 'skip', 'warn', 'interrupt']: |
| 398 | + if state in result_state.keys(): |
| 399 | + result_link += "| %s %s |" % (state.upper(), str(result_state[state])) |
393 | 400 | testsuite.runstatus("Run", "Successfully executed", result_link) |
394 | 401 | else: |
395 | 402 | testsuite.runstatus("Not_Run", "Unable to find job log file") |
@@ -719,13 +726,22 @@ def parse_test_config(test_config_file, avocado_bin, enable_kvm): |
719 | 726 | if args.interval: |
720 | 727 | time.sleep(int(args.interval)) |
721 | 728 |
|
| 729 | + # Finding the space needed for formatting result summary |
| 730 | + test_name_list = [] |
| 731 | + for test_suite in Testsuites_list: |
| 732 | + test_name_list.append(Testsuites[test_suite].name) |
| 733 | + test_name_list.append(Testsuites[Testsuites_list[0]].runlink.split('\n')[0]) |
| 734 | + test_name_list.append(Testsuites[Testsuites_list[0]].runlink.split('\n')[1]) |
| 735 | + longest_name_length = len((sorted(test_name_list, key=len)[-1])) + 5 |
| 736 | + |
722 | 737 | # List the final output |
723 | | - summary_output = ["Summary of test results can be found below:\n%-75s %-10s %-20s" % ('TestSuite', 'TestRun', 'Summary')] |
| 738 | + summary_output = ["Summary of test results can be found below:\n%s %s %s" % ('TestSuite'.ljust(longest_name_length), |
| 739 | + 'TestRun'.ljust(10), 'Summary')] |
724 | 740 | for test_suite in Testsuites_list: |
725 | 741 | summary_output.append(' ') |
726 | | - summary_output.append('%-75s %-10s %-20s' % (Testsuites[test_suite].name, |
727 | | - Testsuites[test_suite].run, |
728 | | - Testsuites[test_suite].runsummary)) |
| 742 | + summary_output.append('%s %s %s' % (Testsuites[test_suite].name.ljust(longest_name_length), |
| 743 | + Testsuites[test_suite].run.ljust(10), |
| 744 | + Testsuites[test_suite].runsummary)) |
729 | 745 | summary_output.append(Testsuites[test_suite].runlink) |
730 | 746 | logger.info("\n".join(summary_output)) |
731 | 747 |
|
|
0 commit comments