Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/dvsim/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import re
import sys
from collections import defaultdict
from collections.abc import Sequence
from pathlib import Path
from typing import Any, TextIO
Expand Down Expand Up @@ -590,16 +589,25 @@ def _sort(self) -> None:
self.testpoints.sort(key=lambda x: x.stage)
self.covergroups.sort(key=lambda x: x.name)

def get_stage_regressions(self):
regressions = defaultdict(set)
def get_stage_regressions(self) -> list[dict[str, str | list[str]]]:
"""Return the testpoints, grouped by verification stage.

The returned value has a dict for each verification stage with
testpoints. This dict has two keys: name and tests. The name field
gives the name of the verification stage. The tests field is a list of
the names of tests associated with testpoints in the stage.

"""
stage_to_tests: dict[str, set[str]] = {}

for tp in self.testpoints:
if tp.not_mapped:
if tp.not_mapped or tp.stage not in Testpoint.stages[1:]:
continue
if tp.stage in tp.stages[1:]:
regressions[tp.stage].update({t for t in tp.tests if t})

# Build regressions dict into a Hjson-like data structure
return [{"name": ms, "tests": list(regressions[ms])} for ms in regressions]
stage_to_tests.setdefault(tp.stage, set()).update(tp.tests)

# Build stage_to_tests dict into a Hjson-like data structure
return [{"name": stage, "tests": sorted(tps)} for stage, tps in stage_to_tests.items()]

def write_testplan_doc(self, output: TextIO) -> None:
"""Write testplan documentation in markdown from the Hjson testplan."""
Expand Down
Loading