Skip to content

refactor: Tidy up how wildcards get expanded in testpoints#221

Open
rswarbrick wants to merge 1 commit into
lowRISC:masterfrom
rswarbrick:wildcard-expand
Open

refactor: Tidy up how wildcards get expanded in testpoints#221
rswarbrick wants to merge 1 commit into
lowRISC:masterfrom
rswarbrick:wildcard-expand

Conversation

@rswarbrick
Copy link
Copy Markdown
Contributor

I think the existing implementation had a bit of a problem if you had multiple wildcard patterns that all expanded to lists of values. Presumably no-one ever cared, but it also wasn't very easy to see how the code worked.

@rswarbrick rswarbrick requested a review from AlexJones0 May 21, 2026 12:51
I think the existing implementation had a bit of a problem if you had
multiple wildcard patterns that all expanded to lists of values.
Presumably no-one ever cared, but it also wasn't very easy to see how
the code worked.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
Comment thread src/dvsim/testplan.py

A wildcard use with no match in substitutions will be replaced by an
empty string (in a single item). For example, if substitutions is {}
and self.tests is ['test-{a}'] then self.tests will become ['test-'].
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: the original implementation feels unintuitive - I feel like most similar systems would retain one copy of the unsubstituted text (i.e. just leave it as ['test-{a}']).

Comment thread src/dvsim/testplan.py
ret.extend(Testpoint._expand_str(pattern, new_vals, txt))
return ret

def do_substitutions(self, substitutions: dict, reserved_names: Sequence[str]) -> None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this substitutions: dict[str, str | list[str]] or is this too strong of a typing to enforce here at this stage? If not, at least substitutions: dict[str, Any]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants