Skip to content

Commit

Permalink
twister: stats: fix platform stats
Browse files Browse the repository at this point in the history
Fix wrong reporting about where testcases were executed.

We have:

INFO    - 1130 of 1130 executed test cases passed (100.00%) on 0 out of
total 860 platforms (0.00%).

which is obviously wrong.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Nov 13, 2024
1 parent 1a5ae37 commit 4cad356
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 3 additions & 1 deletion scripts/pylib/twister/twisterlib/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def __init__(self, plan, env) -> None:
self.instances = plan.instances
self.platforms = plan.platforms
self.selected_platforms = plan.selected_platforms
self.filtered_platforms = plan.filtered_platforms
self.env = env
self.timestamp = datetime.now().isoformat()
self.outdir = os.path.abspath(env.options.outdir)
self.instance_fail_count = plan.instance_fail_count
self.footprint = None


@staticmethod
def process_log(log_file):
filtered_string = ""
Expand Down Expand Up @@ -601,6 +601,8 @@ def summary(self, results, ignore_unrecognized_sections, duration):
)

total_platforms = len(self.platforms)
self.filtered_platforms = set(instance.platform.name for instance in self.instances.values()
if instance.status not in[TwisterStatus.FILTER, TwisterStatus.NOTRUN, TwisterStatus.SKIP])
# if we are only building, do not report about tests being executed.
if self.platforms and not self.env.options.build_only:
executed_cases = results.cases - results.filtered_cases - results.skipped_cases - results.notrun_cases
Expand Down
4 changes: 0 additions & 4 deletions scripts/pylib/twister/twisterlib/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def __init__(self, env=None):
self.platforms = []
self.platform_names = []
self.selected_platforms = []
self.filtered_platforms = []
self.default_platforms = []
self.load_errors = 0
self.instances = dict()
Expand Down Expand Up @@ -1079,9 +1078,6 @@ def apply_filters(self, **kwargs):

filtered_instance.add_missing_case_status(filtered_instance.status)

self.filtered_platforms = set(p.platform.name for p in self.instances.values()
if p.status != TwisterStatus.SKIP )

def add_instances(self, instance_list):
for instance in instance_list:
self.instances[instance.name] = instance
Expand Down
4 changes: 2 additions & 2 deletions scripts/tests/twister_blackbox/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TestPlatform:
'errored_configurations': 0,
'executed_test_cases': 8,
'skipped_test_cases': 2,
'platform_count': 3,
'platform_count': 2,
'executed_on_platform': 4,
'only_built': 2
}
Expand All @@ -59,7 +59,7 @@ class TestPlatform:
'errored_configurations': 0,
'executed_test_cases': 0,
'skipped_test_cases': 0,
'platform_count': 3,
'platform_count': 0,
'executed_on_platform': 0,
'only_built': 0
}
Expand Down

0 comments on commit 4cad356

Please sign in to comment.