twister: print synopsis at the end and instruction for reproducing

If errors are found and tests are failing, print a brief summary showing
the top 10 items failing with instructions on how to reproduce either
with twister or west.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-01-27 11:44:23 +00:00
commit ef9d5bbddf
2 changed files with 26 additions and 0 deletions

View file

@ -414,6 +414,30 @@ class Reporting:
logger.warning("Deltas based on metrics from last %s" %
("release" if not last_metrics else "run"))
def synopsis(self):
cnt = 0
instance = None
for instance in self.instances.values():
if instance.status not in ["passed", "filtered", "skipped"]:
cnt = cnt + 1
if cnt == 1:
logger.info("-+" * 40)
logger.info("The following issues were found (showing the top 10 items):")
logger.info(f"{cnt}) {instance.testsuite.name} on {instance.platform.name} {instance.status} ({instance.reason})")
if cnt == 10:
break
if cnt:
logger.info("")
logger.info("To rerun the tests, call twister using the following commandline:")
logger.info("./scripts/twister -p <PLATFORM> -s <TEST PATH>, for example:")
logger.info("")
logger.info(f"./scripts/twister -p {instance.platform.name} -s {instance.testsuite.name}")
logger.info(f"or with west:")
logger.info(f"west build -b {instance.platform.name} -T {instance.testsuite.name}")
logger.info("-+" * 40)
def summary(self, results, unrecognized_sections, duration):
failed = 0
run = 0