Fix test failures from Catch2 submodule update#4940
Conversation
61972f6 to
2ecbb72
Compare
There was a problem hiding this comment.
Pull request overview
Fixes unit test failures and static analysis warnings caused by the Catch2 submodule update changing test execution order and analyzer behavior.
Changes:
- Reset WER-report test expected globals in each affected test to avoid cross-test state leakage.
- Initialize
reserved_datatonullptrbefore reusing it to silence the analyzer’s uninitialized-memory warning. - Ignore CodeQL’s
_codeql_detected_source_rootartifact to prevent accidental commits.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/unit/wer_report_test_wrapper.cpp | Re-initializes expected WER parameters per test to restore isolation under reordered execution. |
| libs/runtime/unit/platform_unit_test.cpp | Explicitly initializes reserved_data before reuse to address static analysis false positive. |
| .gitignore | Adds ignore rule for CodeQL temporary artifact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Alan-Jowett
left a comment
There was a problem hiding this comment.
LGTM - The changes correctly fix test isolation issues exposed by the Catch2 update:
-
platform_unit_test.cpp: Re-initializing
eserved_data = nullptr\ before the second \�bpf_ring_buffer_reserve\ call is defensive and silences the static analyzer warning correctly. -
wer_report_test_wrapper.cpp: Each test now explicitly sets its expected values instead of relying on global initialization. This makes tests isolated and order-independent, which is the right fix.
-
.gitignore: Good housekeeping for CodeQL artifacts.
Ready to merge once CI passes.
303ed11 to
261dc6b
Compare
261dc6b to
12f08fa
Compare
- Reset WER test global state in each test case to avoid test order dependencies - Initialize reserved_data to nullptr before reuse to satisfy static analyzer Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
12f08fa to
f416397
Compare
Alan-Jowett
left a comment
There was a problem hiding this comment.
LGTM - fixes test isolation issues exposed by Catch2 update. Tests now properly set their own expected state instead of relying on execution order.
Description
Updating Catch2 from
b62413atode7e863changed test execution order, exposing test isolation bugs:WER report tests - Three test cases (
wer_report_fatal_exception,wer_report_non_fatal_exception,wer_report_failure) depend on global state set to "Test Application Crash". Thewatchdog_timeouttest changes this to "Test Application Hang" without reset. Under the new execution order, tests running afterwatchdog_timeoutfail with mismatched expectations.Fix: Initialize expected values in each affected test case:
Static analysis false positive - Analyzer reports uninitialized memory for
reserved_dataat line 1786, despite proper initialization viaebpf_ring_buffer_reserve()and null check. New Catch2 REQUIRE macro likely not recognized as control flow break.Fix: Explicit re-initialization before second use:
reserved_data = nullptr;CodeQL temporary file cleanup - Removed spurious
_codeql_detected_source_rootsymlink that was accidentally committed during security analysis and added it to.gitignoreto prevent future occurrences.Testing
Existing tests in
wer_report_test_wrapper.cppandplatform_unit_test.cppnow pass with updated Catch2.Documentation
No documentation impact.
Installation
No installer impact.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.