Skip to content

BUG: Fail CovarianceSampleFilter3 test when Update() throws - #7049

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:bug-covariance3-swallowed-update
Oct 31, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:bug-covariance3-swallowed-update

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

itkCovarianceSampleFilterTest3 caught an exception from Update(), printed it, and carried on, so a failing filter went unnoticed and the checks that followed read output that was never produced. The catch now fails the test.

This is the same defect fixed in ten other Statistics tests by #7048. It is a separate PR because #7046 converts this test to GoogleTest. If this merges first, the conversion in #7046 gets ASSERT_NO_THROW(filter->Update()) when it is rebased; if #7046 merges first, this PR is rebased to make that change in the GoogleTest instead.

Testing

macOS arm64, conda clang, Release, Module_ITKStatistics=ON. Builds with 0 warnings; itkCovarianceSampleFilterTest3 passes, which confirms that this Update() does not throw today. pre-commit run --all-files passes.

AI assistance (Claude Code) was used to find the defect and draft the change; it was reviewed and tested locally.

The catch block printed the exception and let the test continue, so
a failing Update() went unnoticed and the checks that follow ran on
output that was never produced.
@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Numerics Issues affecting the Numerics module labels Oct 31, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review October 31, 2026 17:12
@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This change appears safe to merge.

Summary

Makes itkCovarianceSampleFilterTest3 return EXIT_FAILURE when filter->Update() throws.

  • The covariance filter test fails when Update() throws.

Reviews (1) · Last reviewed commit: "BUG: Fail CovarianceSampleFilter3 test w..." · Reviewed by Greptile

@hjmjohnson
hjmjohnson merged commit ffda1aa into InsightSoftwareConsortium:main Oct 31, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Numerics Issues affecting the Numerics module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants