Skip to content

Commit

Permalink
NFC: ExtractIRForPassTest.py error reporting when pass not found (#6325)
Browse files Browse the repository at this point in the history
This just adds convenient error reporting to `ExtractIRForPassTest.py`
when the specified pass is not found.

No functional change.
  • Loading branch information
tex3d committed May 24, 2024
1 parent cdc5603 commit 128e6ce
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions utils/hct/ExtractIRForPassTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,18 @@ def SplitAtPass(passes, pass_name, invocation=1):
after = [line]
continue
before.append(line)
if after is None:
raise Exception(f"no such pass: {pass_name}")
if count == 0:
raise ValueError(
"Pass '{}' not found in pass list. Check spelling and that it is a module pass. Pass list: {}".format(
pass_name, passes
)
)
elif count < invocation:
raise ValueError(
"Pass '{}' found {} times, but {} invocations requested. Pass list: {}".format(
pass_name, count, invocation, passes
)
)

return before, after

Expand Down

0 comments on commit 128e6ce

Please sign in to comment.