Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Fix infinite loop when we run out of input #1396

Merged
merged 1 commit into from
Mar 5, 2024
Merged
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
12 changes: 12 additions & 0 deletions cmake/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ def main():
print_incorrect_match(match_idx + 1, input_lines[input_idx].strip(), "");
print_content(input_lines, match_lines, ignored_lines)
sys.exit(1)
elif status == Status.INPUT_END:
# If we get to the end of the input, but still have pending matches,
# then that's a failure unless all pending matches are optional -
# otherwise we're done
while match_idx < len(match_lines):
if not (match_lines[match_idx].startswith(Tag.OPT.value) or
match_lines[match_idx].startswith(Tag.IGNORE.value)):
print_incorrect_match(match_idx + 1, "", match_lines[match_idx]);
print_content(input_lines, match_lines, ignored_lines)
sys.exit(1)
match_idx += 1
sys.exit(0)

input_line = input_lines[input_idx].strip() if input_idx < len(input_lines) else ""
match_line = match_lines[match_idx]
Expand Down