Repository navigation
COMP: Compile the UnitTestCommon helpers once per test target - #1983
Merged
imikejackson merged 2 commits intoNov 19, 2026
Merged
imikejackson merged 2 commits into
imikejackson merged 2 commits into
Conversation
joeykleingers
added a commit
to joeykleingers/simplnx
that referenced
this pull request
Nov 16, 2026
…e entry Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
joeykleingers
added a commit
to joeykleingers/simplnx
that referenced
this pull request
Nov 16, 2026
…e entry Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
joeykleingers
force-pushed
the
topic/unittestcommon-compile-time
branch
from
November 16, 2026 16:00
8579166 to
426954b
Compare
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
6 of 7 tasks
imikejackson
approved these changes
Nov 19, 2026
imikejackson
enabled auto-merge (squash)
November 19, 2026 18:34
imikejackson
pushed a commit
to joeykleingers/simplnx
that referenced
this pull request
Nov 19, 2026
…e entry Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
imikejackson
force-pushed
the
topic/unittestcommon-compile-time
branch
from
November 19, 2026 18:34
426954b to
1ab10ea
Compare
UnitTestCommon.hpp defined 25 helpers inline. Every test file that includes it compiled their bodies and the templates they instantiate, and each object that called one generated it again. 24 of them are now defined in UnitTestCommon.cpp, which each test target already compiles once; the header keeps the declarations, default arguments and documentation. CompareMontage, Constants::k_CalculatedShiftsPath and Constants::k_ActiveArrayPath had no users and are removed. The namespace-scope DataPath, FilterHandle and DataPath-list constants are inline, so each program has one object instead of one per test file. The UUIDs that the FilterHandle constants bind by reference are inline as well, so every definition of a handle refers to the same objects. The knowledge base gets a Testing entry on defining shared test helpers in a source file. Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
…e entry Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
imikejackson
force-pushed
the
topic/unittestcommon-compile-time
branch
from
November 19, 2026 20:34
1ab10ea to
0b4239a
Compare
Contributor
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
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.
Summary
UnitTestCommon.hppdefined 25 test helpersinline. Every test file that includes the header compiled their bodies and the templates that they instantiate, also when the file did not call them. This change moves 24 helpers toUnitTestCommon.cpp, which each test target compiles once. It also makes the namespace-scope constants one object per program, removes three names that nothing uses, and adds a knowledge-base entry. The behavior of the tests does not change. 3 files changed, +1149 / −1069 lines.1. Helpers defined in the source file
test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp: declarations, default arguments and documentation of the helpers.test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.cpp: the 24 definitions, with unchanged bodies.The moved helpers include
LoadPlugins,CheckArraysInheritTupleDims,CompareDataStructures,CompareImageGeometry,CompareExemplarToGeneratedData,CreateDataStructure, theCroppinghelpers and theSmallIn100helpers. The template helpers stay in the header. The header keeps all of its includes, so test files that use names from those includes compile without changes.The 18
DataPathconstants, the twoFilterHandleconstants and theSmallIn100::k_TupleCheckIgnoredPathslist areinline const. Each test program has one object of each, not one copy in each test file. The threeUuidconstants that theFilterHandleconstants refer to areinline constexpr, so that every definition of a handle refers to the same objects.2. Removed names
UnitTest::CompareMontage,Constants::k_CalculatedShiftsPathandConstants::k_ActiveArrayPathhad no users in simplnx, DREAM3D-NX or the simplnx plugin repositories, and are removed.3. Compatibility
UnitTestCommon.hppand calls a moved helper must compileUnitTestCommon.cpp. Targets that link thesimplnx::UnitTestCommonCMake target (all simplnx test targets,conversion_testand the DREAM3D-NX test targets) get it automatically.4. Knowledge base
docs/Coding_Knowledge_Base.md: new Testing entry "Define shared test helpers in a source file, not inline in a header".5. Measured compile time
On macOS (AppleClang, Release), each of the 332 objects in the in-core DREAM3D-NX build that includes
UnitTestCommon.hppwas compiled with and without the change, two times each. The total compile CPU time is 1652 s before and 1374 s after (−278 s, −16.8%). The test files use 305 s less (0.96 s per file on average; no file is slower).UnitTestCommon.cppuses 33.5 s more, for its 7 compiles. The out-of-core test targets were not measured.Test plan
develop.VizTestsand the benchmark pass.ooclabel (without benchmarks) pass, including the out-of-core plugin's test targets.UnitTestCommon.cppone time and has one definition of each moved helper.Related Issue