Describe the Testing Issue
Summary
On the LTS branch, the Integration Test and Unit Test / Test (pull_request) workflow can fail during the build step when BUILD_TESTING=ON is enabled. The failure happens before the test step is executed.
Failure
Affected targets include:
XCTest_HSE
XCTest_PBE
XCTest_PZ_SPN
XCTest_SCAN
Representative linker error:
/usr/bin/ld: CMakeFiles/XCTest_HSE.dir/__/xc_functional.cpp.o:
undefined reference to `ModuleBase::TITLE(std::string const&, std::string const&, bool)'
collect2: error: ld returned 1 exit status
Root Cause
source/module_hamilt_general/module_xc/xc_functional.cpp calls ModuleBase::TITLE(...)
The implementation of ModuleBase::TITLE is provided by: source/module_base/tool_title.cpp
The main ABACUS executable links the base object library, which includes tool_title.cpp, so the main program builds successfully.
However, several module_xc unit test targets in: source/module_hamilt_general/module_xc/test/CMakeLists.txt compile ../xc_functional.cpp directly into standalone test executables without also linking or compiling the implementation that provides ModuleBase::TITLE. As a result, those test executables fail at link time.
Expected Behavior
All module_xc unit test executables should link successfully when BUILD_TESTING=ON.
Additional Context
This problem is raised from #7321, However the failure of Integration Test and Unit Test / Test (pull_request) seems to have no relation with toolchain update, which should be fixed seperately from Toolchain PR.
Task list for Issue attackers (only for developers)
Describe the Testing Issue
Summary
On the LTS branch, the
Integration Test and Unit Test / Test (pull_request)workflow can fail during the build step whenBUILD_TESTING=ONis enabled. The failure happens before the test step is executed.Failure
Affected targets include:
XCTest_HSEXCTest_PBEXCTest_PZ_SPNXCTest_SCANRepresentative linker error:
Root Cause
source/module_hamilt_general/module_xc/xc_functional.cppcallsModuleBase::TITLE(...)The implementation of ModuleBase::TITLE is provided by:
source/module_base/tool_title.cppThe main ABACUS executable links the
baseobject library, which includestool_title.cpp, so the main program builds successfully.However, several
module_xcunit test targets in:source/module_hamilt_general/module_xc/test/CMakeLists.txtcompile../xc_functional.cppdirectly into standalone test executables without also linking or compiling the implementation that providesModuleBase::TITLE. As a result, those test executables fail at link time.Expected Behavior
All
module_xcunit test executables should link successfully whenBUILD_TESTING=ON.Additional Context
This problem is raised from #7321, However the failure of
Integration Test and Unit Test / Test (pull_request)seems to have no relation with toolchain update, which should be fixed seperately from Toolchain PR.Task list for Issue attackers (only for developers)