Skip to content

Commit ff1857a

Browse files
LukaszMrugalammahadevan108
authored andcommitted
scripts: twister: Enchance TestCase/Instance info and presentation
ExecutionCounter has been expanded and now hold i.a. more information on the statuses of TestCases. This information is now incorporated in relevant summaries - runner.py and reports.py. Layout of those was changed to present that and previous information in a clear and concise way. TestInstance execution counter now is more intuitive. Instances filtered out before running are no longer included there. Retries now properly reset the counter. TestCases with None and other incorrect final statuses are logged as errors, but do not exit Twister with a nonzero exit code. This is because None statuses, although incorrect, are currently common. Inconsistent spacing in ERROR and FAILED fixed. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com> scripts: Dmitri fix Fix of a problem noticed by Dmitri Removed unnecessary additional spaces when printing FAILED and ERROR status. Now TwisterStatus.get_color is used more. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
1 parent 502c9ff commit ff1857a

File tree

7 files changed

+549
-173
lines changed

7 files changed

+549
-173
lines changed

scripts/pylib/twister/twisterlib/reports.py

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -584,39 +584,43 @@ def summary(self, results, ignore_unrecognized_sections, duration):
584584
pass_rate = 0
585585

586586
logger.info(
587-
"{}{} of {}{} test configurations passed ({:.2%}), {} built (not run), {}{}{} failed, {}{}{} errored, {} skipped with {}{}{} warnings in {:.2f} seconds".format(
588-
Fore.RED if failed else Fore.GREEN,
589-
results.passed,
590-
results.total,
591-
Fore.RESET,
592-
pass_rate,
593-
results.notrun,
594-
Fore.RED if results.failed else Fore.RESET,
595-
results.failed,
596-
Fore.RESET,
597-
Fore.RED if results.error else Fore.RESET,
598-
results.error,
599-
Fore.RESET,
600-
results.skipped_configs,
601-
Fore.YELLOW if self.plan.warnings else Fore.RESET,
602-
self.plan.warnings,
603-
Fore.RESET,
604-
duration))
587+
f"{TwisterStatus.get_color(TwisterStatus.FAIL) if failed else TwisterStatus.get_color(TwisterStatus.PASS)}{results.passed}"
588+
f" of {results.total - results.skipped_configs}{Fore.RESET}"
589+
f" executed test configurations passed ({pass_rate:.2%}),"
590+
f" {f'{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{results.notrun}{Fore.RESET}' if results.notrun else f'{results.notrun}'} built (not run),"
591+
f" {f'{TwisterStatus.get_color(TwisterStatus.FAIL)}{results.failed}{Fore.RESET}' if results.failed else f'{results.failed}'} failed,"
592+
f" {f'{TwisterStatus.get_color(TwisterStatus.ERROR)}{results.error}{Fore.RESET}' if results.error else f'{results.error}'} errored,"
593+
f" with {f'{Fore.YELLOW}{self.plan.warnings}{Fore.RESET}' if self.plan.warnings else 'no'} warnings"
594+
f" in {duration:.2f} seconds."
595+
)
605596

606597
total_platforms = len(self.platforms)
607598
# if we are only building, do not report about tests being executed.
608599
if self.platforms and not self.env.options.build_only:
609-
logger.info("In total {} test cases were executed, {} skipped on {} out of total {} platforms ({:02.2f}%)".format(
610-
results.cases - results.skipped_cases - results.notrun,
611-
results.skipped_cases,
612-
len(self.filtered_platforms),
613-
total_platforms,
614-
(100 * len(self.filtered_platforms) / len(self.platforms))
615-
))
600+
executed_cases = results.cases - results.filtered_cases - results.skipped_cases - results.notrun_cases
601+
pass_rate = 100 * (float(results.passed_cases) / float(executed_cases)) \
602+
if executed_cases != 0 else 0
603+
platform_rate = (100 * len(self.filtered_platforms) / len(self.platforms))
604+
logger.info(
605+
f'{results.passed_cases} of {executed_cases} executed test cases passed ({pass_rate:02.2f}%)'
606+
f'{", " + str(results.blocked_cases) + " blocked" if results.blocked_cases else ""}'
607+
f'{", " + str(results.failed_cases) + " failed" if results.failed_cases else ""}'
608+
f'{", " + str(results.error_cases) + " errored" if results.error_cases else ""}'
609+
f'{", " + str(results.none_cases) + " without a status" if results.none_cases else ""}'
610+
f' on {len(self.filtered_platforms)} out of total {total_platforms} platforms ({platform_rate:02.2f}%).'
611+
)
612+
if results.skipped_cases or results.filtered_cases or results.notrun_cases:
613+
logger.info(
614+
f'{results.skipped_cases + results.filtered_cases} selected test cases not executed:' \
615+
f'{" " + str(results.skipped_cases) + " skipped" if results.skipped_cases else ""}' \
616+
f'{(", " if results.skipped_cases else " ") + str(results.filtered_cases) + " filtered" if results.filtered_cases else ""}' \
617+
f'{(", " if results.skipped_cases or results.filtered_cases else " ") + str(results.notrun_cases) + " not run (built only)" if results.notrun_cases else ""}' \
618+
f'.'
619+
)
616620

617621
built_only = results.total - run - results.skipped_configs
618622
logger.info(f"{Fore.GREEN}{run}{Fore.RESET} test configurations executed on platforms, \
619-
{Fore.RED}{built_only}{Fore.RESET} test configurations were only built.")
623+
{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{built_only}{Fore.RESET} test configurations were only built.")
620624

621625
def save_reports(self, name, suffix, report_dir, no_update, platform_reports):
622626
if not self.instances:

0 commit comments

Comments
 (0)