test: improve test logging infra by benhillis · Pull Request #13811 · microsoft/WSL
Pull request overview
This PR fixes two bugs in the test logging infrastructure to improve reliability and correctness of test result reporting. The changes prevent false positives from crashed test processes and fix incorrect printf format strings that were causing test names to be displayed as "null".
Key Changes
- Added explicit verification of test process exit codes to catch crashes that occur without prior error logging
- Fixed incorrect printf format strings in Linux unit test logging by removing extraneous
falsearguments - Changed test assertion approach from exception-based (
THROW_HR_IF) to framework-based (VERIFY_IS_TRUE) for better test failure reporting
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/windows/Common.cpp | Captures exit code in variable for logging, adds VERIFY_ARE_EQUAL check on exit code, and changes THROW_HR_IF to VERIFY_IS_TRUE for test pass/fail verification |
| test/linux/unit_tests/unittests.c | Removes incorrect false arguments from LxtLogPassed and LxtLogError calls that were causing test names to print as "null" due to printf format mismatch |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.