Repository navigation
refactor(dfpt): replace the shared fixture base class with a free-function test tool - #8270
Merged
mohanchen merged 9 commits intoNov 4, 2026
Merged
Conversation
…ction test tool
The DFPTSerialBase base class and its header are removed in favor of
dfpt_test_tool.{h,cpp} (the module_pw test/test_tool pattern): shared
declarations plus one implementation TU of free functions -- setup_cell,
make_coulomb_atom, make_nc_atom, make_two_atom_cell, make_nlcc_two_atom_
cell, setup_bases, vloc_coulomb, analytic_dvloc, fkey, gkey -- and the
shared test-world constants (lat0 / ecutwfc / rho_mult / cubic_edge).
Every test file now derives its own fixture directly from ::testing::Test,
owns its objects as members and calls the utilities it needs; there is no
shared fixture base class and no fixture header. The rho files keep their
file-local RNG. CMakeLists swaps dfpt_serial_fixture.cpp for
dfpt_test_tool.cpp in every target. setup_bases keeps the raw assembly
chains and adopts PW_Basis::init_serial once deepmodeling#8268 lands. All six serial
targets rebuilt from deleted binaries (make rc=0); case counts conserved
(pert 7 / phon 20 / rho 11 / q0 6 / xc 6 / write_dyn 6); full MODULE_DFPT
ctest 10/10.
ABACUS-PR-BOT
left a comment
Collaborator
There was a problem hiding this comment.
Static review of 68d7f3fd5 found no functional regression in the fixture extraction; two include cleanups are noted below. Builds and tests were not run.
… test includes Per review: dfpt_test_tool.h uses Matrix3 and Vector3 only by reference, so they are forward-declared like the other argument types and their definitions are included only where needed (the tool implementation and the fixtures that use them). The include blocks duplicated by the fixture rewrite (the original std/gtest includes surviving below the inserted fixture) are removed -- 28 duplicate lines across ten files, first occurrence kept everywhere. All six serial targets rebuilt from deleted binaries (make rc=0); case counts conserved; full MODULE_DFPT ctest 10/10.
Zanthoxylum
force-pushed
the
refactor-dfpt-test-tool
branch
from
November 4, 2026 03:56
68d7f3f to
95eedc4
Compare
The 'Build with Makefile & Intel compilers' run hit runner disk exhaustion during the container image pull (no space left on device writing libmkl_sycl_blas.so.5, retried 3x) -- an infrastructure failure on that runner; all code-targeting checks are green or in progress.
Per review: the Matrix3 forward-declaration edit left a second copy of the ModuleCell::QList and ModuleDFPT::DFPT_PW_Data blocks in the tool header; one pair removed. Two consuming targets rebuilt from deleted binaries; full MODULE_DFPT ctest 10/10.
16 tasks
The deferred-adoption note pointed at a serial assembly API proposal that is being withdrawn: the production pw::setup_pwrho / setup_pwwfc wrappers already run without __MPI, and the tests keep their own five-call chains because they need rho_mult = 9x ecutwfc (production hardcodes 4x), re-assemble for arbitrary (k, q) pairs per case (the K_Vectors-driven wrapper is not shaped for that), and want to avoid the wrappers' GlobalV::ofs_running read and a fabricated Input_para. Comment-only change; MODULE_DFPT_rho_serial rebuilt from a deleted binary; full ctest 10/10.
Zanthoxylum
force-pushed
the
refactor-dfpt-test-tool
branch
from
November 4, 2026 07:23
55b1f7f to
ea3e43f
Compare
The governance checker counts global-class names even in comments; rephrase to 'the running-log global stream'.
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
DFPTSerialBase(the shared gtest fixture base class and its header,dfpt_serial_fixture.{h,cpp}) is replaced by a free-function test tool,following the established
module_pw test/test_tool.{h,cpp}pattern:small declaration-only header + one implementation TU compiled into
every test target.
dfpt_test_tool.{h,cpp}provides the shared utilities as freefunctions —
setup_cell,make_coulomb_atom,make_nc_atom,make_two_atom_cell,make_nlcc_two_atom_cell,setup_bases,vloc_coulomb,analytic_dvloc,fkey,gkey— plus the sharedtest-world constants (
lat0,ecutwfc,rho_mult,cubic_edge).::testing::Test, owns its objects (ucell_,pw_rho_,pw_wfc_,qlist_,data_,q_cart_, ...) as members and calls exactly theutilities it needs. There is no shared fixture base class and no
fixture header anywhere in the module.
CMakeLists.txtswapsdfpt_serial_fixture.cppfordfpt_test_tool.cppin every test target.setup_baseskeeps its own five-call assembly chains instead ofcalling the production
pw::setup_pwrho/pw::setup_pwwfcwrappers(which also run without
__MPI): the tests needrho_mult = 9x ecutwfcfor the DFPT convolution (everyDelta = G''-G'must fit inthe rho ball) while production hardcodes
4x ecutwfcand couples therho/wfc balls through the same
inp.ecutwfc; they re-assemble forarbitrary
(k, q)pairs per case, which theK_Vectors-drivenwrapper signature is not shaped for; and calling the wrappers would
drag a fabricated
Input_paraand a running-log global-stream readinto the unit tests. The rationale is documented in the tool source.
Verification
code 0 per target).
write_dyn 6 (identical case names, none added or lost).
MODULE_DFPTsuite: 10/10, re-run after every review round(fixture inline / include dedup / forward declarations / develop
merge).
agent_governance_check.py --base origin/develop --head HEAD:no errors.
Documentation
No docs change needed: test-only refactor with no INPUT, interface, or
behavior change.