-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Fix compilation tests find commands #30194
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
base: main
Are you sure you want to change the base?
Fix compilation tests find commands #30194
Conversation
Signed-off-by: ProExpertProg <[email protected]>
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.
Code Review
This pull request fixes an issue with test command execution in the Buildkite pipeline by replacing find -exec with a find | xargs pipe. This correctly propagates pytest exit codes, ensuring that test failures are properly reported. However, the new implementation has a potential issue: if find does not locate any test files, the step will pass silently. This could mask problems in the test suite. I've added suggestions to make these steps fail if no test files are found, which will make the CI pipeline more robust.
.buildkite/test-pipeline.yaml
Outdated
| - > | ||
| find compile/ -maxdepth 1 -name 'test_*.py' -print0 | | ||
| xargs -0 -n1 -I{} pytest -s -v "{}" |
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.
While this change correctly propagates pytest exit codes, it introduces an issue where the step will silently pass if find doesn't locate any test files. A test step that is expected to run tests should fail if no tests are found to avoid giving a false sense of security. I suggest adding a check to ensure at least one test file is found.
- |
set -e -o pipefail
found_files=$(find compile/ -maxdepth 1 -name 'test_*.py' -print0)
if [ -z "$found_files" ]; then
echo "FAIL: No test files found for PyTorch Compile Smoke Test" >&2
exit 1
fi
printf "%s" "$found_files" | xargs -0 -n1 -I{} pytest -s -v "{}"
.buildkite/test-pipeline.yaml
Outdated
| - > | ||
| find compile/fullgraph -maxdepth 1 -name 'test_*.py' -not -name 'test_full_graph.py' -print0 | | ||
| xargs -0 -n1 -I{} pytest -s -v "{}" |
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.
Similar to the previous comment, this change will cause the test step to pass silently if no test files are found. This can mask issues, for example if test files are accidentally moved or renamed. To ensure the CI pipeline is robust, the step should fail if it's expected to run tests but doesn't find any.
- |
set -e -o pipefail
found_files=$(find compile/fullgraph -maxdepth 1 -name 'test_*.py' -not -name 'test_full_graph.py' -print0)
if [ -z "$found_files" ]; then
echo "FAIL: No test files found for PyTorch Fullgraph Smoke Test" >&2
exit 1
fi
printf "%s" "$found_files" | xargs -0 -n1 -I{} pytest -s -v "{}"Signed-off-by: ProExpertProg <[email protected]>
Signed-off-by: ProExpertProg <[email protected]>
Signed-off-by: ProExpertProg <[email protected]>
ApostaC
left a comment
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.
Overall LGTM. Just a quick question: what will happen if there is no file found?
Purpose
Compilation tests were using the
findcommand, which does not propagate errors, so the CI passes even when tests fail.Test Plan
CI (first commit should fail)
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.