Skip to content

Improve failure reporting in op_shape_test#4868

Open
pfultz2 wants to merge 6 commits into
developfrom
test-report-op-shape-test
Open

Improve failure reporting in op_shape_test#4868
pfultz2 wants to merge 6 commits into
developfrom
test-report-op-shape-test

Conversation

@pfultz2
Copy link
Copy Markdown
Collaborator

@pfultz2 pfultz2 commented May 8, 2026

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::failed logger to report test failures. This will also report the line number as well.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

Copilot AI review requested due to automatic review settings May 8, 2026 20:54
@pfultz2 pfultz2 requested a review from causten as a code owner May 8, 2026 20:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::failed RAII logger that increments failure count and prints formatted failure output.
  • Reworked CHECK/EXPECT to route through a new check_predicate helper and pass a TEST_SOURCE_LOCATION.
  • Refactored op_shape_test helper functions into CTAD-enabled helper types (expect_shape / throws_shape) that use test::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 thread test/include/test.hpp
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 thread test/op_shape_test.cpp
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{})
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants