Repository navigation
refactor(dfpt): replace the stru fixture base class with a free-function test tool - #8283
Merged
mohanchen merged 6 commits intoNov 4, 2026
Merged
Conversation
…ion test tool
DFPTStruTestFixture and its header are removed in favor of
dfpt_stru_tool.{h,cpp} (the same free-function pattern as the serial
side's dfpt_test_tool and module_pw's test_tool): the structure-table
types (atomtype_ / stru_), the default cubic carbon table
(cubic_carbon_stru) and construct_ucell as free functions. The two
consumers derive their fixtures directly from ::testing::Test, own
their UnitCell and call the utilities; the cleanup deletes the atoms
array inline. CMakeLists swaps dfpt_stru_fixture.cpp for
dfpt_stru_tool.cpp in both targets. After this the module has no
shared fixture base classes or fixture headers anywhere (test_serial
and test alike). Both targets rebuilt from deleted binaries (make
rc=0); case counts conserved (pw_data 6 / pw_run 3); full MODULE_DFPT
ctest 10/10.
ABACUS-PR-BOT
left a comment
Collaborator
There was a problem hiding this comment.
Static review of 00d1f832: two nonblocking suggestions. No builds or tests were run.
… the tool-header claim Per review: both consumers store cubic_carbon_stru() in a named const dfpt_test::stru_ local before calling construct_ucell (rule 14), and the tool header no longer references test_serial/dfpt_test_tool, which is not on develop at this head -- it now cites module_pw's test/test_tool pattern and marks the serial-side counterpart as pending review, with the no-shared-fixture claim scoped to this directory. Both targets rebuilt from deleted binaries; full MODULE_DFPT ctest 10/10.
16 tasks
ABACUS-PR-BOT
left a comment
Collaborator
There was a problem hiding this comment.
Static re-review of dfe20479 found no new issues. No builds or tests were run.
mohanchen
approved these changes
Nov 4, 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.
Summary
DFPTStruTestFixture(the shared fixture base class and its header onthe MPI-side test directory,
test/dfpt_stru_fixture.{h,cpp}) isreplaced by a free-function test tool — the same pattern as #8270's
serial-side
dfpt_test_tooland the establishedmodule_pw test/test_tool:test/dfpt_stru_tool.{h,cpp}: the structure-table types(
atomtype_/stru_), the default cubic-carbon table(
cubic_carbon_stru()) andconstruct_ucell(UnitCell&, const stru_&)as free functions — bodies moved verbatim from the fixture.
dfpt_pw_data_test.cpp/dfpt_pw_run_test.cppderive theirfixtures directly from
::testing::Test, own theirUnitCellandcall the utilities; the atoms cleanup is inline (
delete[] ucell.atoms).CMakeLists.txtswapsdfpt_stru_fixture.cppfordfpt_stru_tool.cppin both targets.After this PR the MPI-side test directory has no shared fixture base
class and no fixture header: every test file there is self-contained
in gtest style, and its shared facility is this free-function utility
pair (plus the
dfpt_test_mockslink stubs). The serial-sidecounterpart (
dfpt_test_tool, removingdfpt_serial_fixture) is thepending #8270 — until it lands,
test_serial/still carries its ownfixture; the two removals are independent.
No dependency on the open PRs: zero file overlap with #8268 /
#8270 / #8262 (they touch the
test_serial/side and module_pw only).Verification
code 0).
MODULE_DFPTsuite: 10/10.Documentation
No docs change needed: test-only refactor with no INPUT, interface, or
behavior change.