Improve failure reporting in op_shape_test#4868
Open
pfultz2 wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the internal test harness and op_shape_test helpers so test failures are counted and surfaced in the final summary (instead of relying on ctest regex matching), with an intent to improve failure context by including source locations.
Changes:
- Added
test::failedRAII logger that increments failure count and prints formatted failure output. - Reworked
CHECK/EXPECTto route through a newcheck_predicatehelper and pass aTEST_SOURCE_LOCATION. - Refactored
op_shape_testhelper functions into CTAD-enabled helper types (expect_shape/throws_shape) that usetest::failed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/op_shape_test.cpp | Converts shape helper functions to CTAD-enabled helper types and switches failure reporting to test::failed. |
| test/include/test.hpp | Introduces source_location, failed logger, and updates CHECK/EXPECT macros to report failures via a unified path. |
Comment on lines
+51
to
+57
| const char* function = __builtin_FUNCTION(); | ||
| const char* file = __builtin_FILE(); | ||
| int line = __builtin_LINE(); | ||
| }; | ||
| #else | ||
| struct source_location | ||
| { |
Comment on lines
+45
to
49
| expect_shape(const migraphx::shape& expected, | ||
| const migraphx::operation& op, | ||
| Ts... xs, | ||
| test::source_location loc = test::source_location{}) | ||
| { |
shivadbhavsar
approved these changes
May 11, 2026
TedThemistokleous
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
If a test failed, it would print FAILED but then report all tests passed at the end as it relied on the REGEX matching in ctest. This will now report the test failures.
Technical Details
This was updated to add a
test::failedlogger to report test failures. This will also report the line number as well.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable