-
Notifications
You must be signed in to change notification settings - Fork 113
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1396 +/- ##
==========================================
- Coverage 14.82% 12.51% -2.31%
==========================================
Files 250 239 -11
Lines 36220 35942 -278
Branches 4094 4076 -18
==========================================
- Hits 5369 4498 -871
- Misses 30800 31440 +640
+ Partials 51 4 -47 ☔ View full report in Codecov by Sentry. |
Looks like the CUDA match file needs updated after this patch? |
Yeah. I'll see what I can do |
cmake/match.py
Outdated
@@ -93,6 +93,12 @@ 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a scenario where we get to the end of the input, and the remaining matches are marked with {{OPT}}
. In that case we expect a success.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like this could work:
elif status == Status.INPUT_END and input_idx >= len(match_lines) + len(ignored_lines):
print_incorrect_match(match_idx + 1, "", match_lines[match_idx]);
print_content(input_lines, match_lines, ignored_lines)
sys.exit(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's good. Just ran into the ignored lines problem. I'll add that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with a loop to consume remaining matches rather than just arithmetic because non-optional matches might still remain e.g.
matchfile:
{{OPT}} foo
bar
{{OPT}}baz
input:
foo
Thanks for the suggestion
d6930c7 introduced Status.INPUT_END but didn't introduce the means to handle that eventuality. It looks like the intention might have been to exit with success if we've got to the end of input. However, if we run out of input and still have matches pending, I'm treating this as a failure
d6930c7 introduced
Status.INPUT_END
but didn't introduce the means to handle that eventuality. It looks like the intention might have been to exit with success if we've got to the end of input. However, if we run out of input and still have matches pending, I'm treating this as a failure.Infinite loop reproducer:
_matchtmpfile.txt
input.txt