From 5ab9bcfdf3e15e76fe3db17abe1c62dec48f0504 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 30 Jan 2023 15:43:36 -0500 Subject: [PATCH] twister: fix reporting and example in synopsis Take an instance that has failed and not whatever was last processed in the for loop. Also, change instructions to use `west twister` rather than `./scripts/twister` to be consistent. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/reports.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index 22a5911e200..39b843e01f2 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -416,7 +416,7 @@ class Reporting: def synopsis(self): cnt = 0 - instance = None + example_instance = None for instance in self.instances.values(): if instance.status not in ["passed", "filtered", "skipped"]: cnt = cnt + 1 @@ -425,17 +425,18 @@ class Reporting: 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})") + example_instance = instance if cnt == 10: break - if cnt: + if cnt and example_instance: logger.info("") logger.info("To rerun the tests, call twister using the following commandline:") - logger.info("./scripts/twister -p -s , for example:") + logger.info("west twister -p -s , for example:") logger.info("") - logger.info(f"./scripts/twister -p {instance.platform.name} -s {instance.testsuite.name}") + logger.info(f"west twister -p {example_instance.platform.name} -s {example_instance.testsuite.name}") logger.info(f"or with west:") - logger.info(f"west build -b {instance.platform.name} -T {instance.testsuite.name}") + logger.info(f"west build -p -b {example_instance.platform.name} -T {example_instance.testsuite.name}") logger.info("-+" * 40) def summary(self, results, unrecognized_sections, duration):