Commit ef9d5bbd authored by Anas Nashif's avatar Anas Nashif
Browse files

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: default avatarAnas Nashif <anas.nashif@intel.com>
parent 79b955c8
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -223,6 +223,8 @@ def main(options):
        options.platform_reports,
    )

    report.synopsis()

    if options.package_artifacts:
        artifacts = Artifacts(env)
        artifacts.package()