Skip to content

ENH: Convert 8 IO/ImageBase tests to GoogleTest#6177

Merged
hjmjohnson merged 2 commits intoInsightSoftwareConsortium:mainfrom
hjmjohnson:convert-io-imagebase-gtest
May 4, 2026
Merged

ENH: Convert 8 IO/ImageBase tests to GoogleTest#6177
hjmjohnson merged 2 commits intoInsightSoftwareConsortium:mainfrom
hjmjohnson:convert-io-imagebase-gtest

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

Mechanical CTest → GTest conversion for the 8 no-argument tests in Modules/IO/ImageBase/test. Each test was renamed via git mv, body translated to GTest macros (EXPECT_THROW, EXPECT_EQ, ITK_GTEST_EXERCISE_BASIC_OBJECT_METHODS), removed from the legacy test driver, and registered in ITKIOImageBaseGTests.

Tests converted
Old New
itkImageFileReaderTest1 itkImageFileReaderGTest1
itkImageIOFileNameExtensionsTests itkImageIOFileNameExtensionsGTests
itkConvertBufferTest2 itkConvertBufferGTest2
itkNumericSeriesFileNamesTest itkNumericSeriesFileNamesGTest
itkConvertBufferTest itkConvertBufferGTest
itkIOCommonTest2 itkIOCommonGTest2
itkIOCommonTest itkIOCommonGTest
itkImageIOBaseTest itkImageIOBaseGTest
Test plan
  • cmake --build build --target ITKIOImageBaseGTestDriver succeeds
  • Each converted test passes (ctest -R '^…\.ConvertedLegacyTest\$')
  • pre-commit run --all-files clean on final tree
  • CI green

@hjmjohnson hjmjohnson marked this pull request as ready for review May 1, 2026 02:10
@greptile-apps

This comment was marked as resolved.

Comment thread Modules/IO/ImageBase/test/itkImageFileReaderGTest1.cxx
@hjmjohnson hjmjohnson force-pushed the convert-io-imagebase-gtest branch from a8b5f6a to 60a130c Compare May 1, 2026 02:32
@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:IO Issues affecting the IO module labels May 1, 2026
@hjmjohnson hjmjohnson enabled auto-merge May 1, 2026 10:01
@hjmjohnson hjmjohnson requested review from dzenanz May 1, 2026 15:25
@hjmjohnson hjmjohnson self-assigned this May 1, 2026
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request May 1, 2026
The pinned v0.8 (2018-2019) ships an action that builds the Go binary
from source on every CI run.  Each build downloads dependencies from
gopkg.in, which intermittently fails the TLS handshake and aborts the
labeling job.  The failure has been observed across multiple recent
PRs (InsightSoftwareConsortium#5775, InsightSoftwareConsortium#6177, InsightSoftwareConsortium#6164 -- 'Docker build failed with exit code 1' from
'go: gopkg.in/check.v1: net/http: TLS handshake timeout').

srvaroa/labeler ships a pre-built Docker image starting at v1.8.1, so
newer versions skip the Go-compile step entirely.  The maintainer
publishes a floating 'v1' major tag that auto-tracks minor/patch
releases; v1.14.0 is current upstream.

The v1 schema replaces the v0.8-era flat dict-of-rules with a
'version: 1' header + 'labels:' list of {label, title, files, ...}
objects, so .github/labeler.yml is migrated alongside the workflow
bump.  Pattern semantics are unchanged: both v0.8 and v1 use Go's
RE2 regex engine, matching unanchored against PR file paths -- so
existing patterns like 'Modules/IO/*' (which is regex 'Modules/IO/'
followed by zero-or-more '/') continue to behave the same in v1.
dzenanz added 2 commits May 4, 2026 12:48
Mechanical CTest -> GTest conversion for the no-argument tests in
Modules/IO/ImageBase/test:

- itkImageFileReaderTest1 -> itkImageFileReaderGTest1
- itkImageIOFileNameExtensionsTests -> itkImageIOFileNameExtensionsGTests
- itkConvertBufferTest2 -> itkConvertBufferGTest2
- itkNumericSeriesFileNamesTest -> itkNumericSeriesFileNamesGTest
- itkConvertBufferTest -> itkConvertBufferGTest
- itkIOCommonTest2 -> itkIOCommonGTest2
- itkIOCommonTest -> itkIOCommonGTest
- itkImageIOBaseTest -> itkImageIOBaseGTest

Each conversion preserves intent and assertions; ITK_TRY_EXPECT_EXCEPTION
becomes EXPECT_THROW, ITK_TEST_EXPECT_EQUAL becomes EXPECT_EQ, and
ITK_EXERCISE_BASIC_OBJECT_METHODS becomes ITK_GTEST_EXERCISE_BASIC_OBJECT_METHODS.
@dzenanz dzenanz force-pushed the convert-io-imagebase-gtest branch from 60a130c to 53f92f5 Compare May 4, 2026 16:54
Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

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

Looks good with this file rename which ensures git tracking continuity.

@hjmjohnson hjmjohnson merged commit b5745aa into InsightSoftwareConsortium:main May 4, 2026
9 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:IO Issues affecting the IO module type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots 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