Skip to content

[LTS] Integration test failed from module_xc unit tests failing to link due to missing ModuleBase::TITLE dependency #7322

@QuantumMisaka

Description

@QuantumMisaka

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)

  • Understand the testing issue described by the developer.
  • Review the specific test case, expected and actual results, and any error messages.
  • Identify the root cause of the test failure or issue.
  • If a possible solution is suggested, evaluate its feasibility and effectiveness.
  • Implement a fix for the test failure or issue, or create a new test case if needed.
  • Verify that the fix resolves the testing issue and the test case passes.
  • Review and update any relevant documentation, such as test plans or user guides.
  • Ensure the testing issue is resolved and close the ticket.
  • Share any lessons learned or best practices with the team to prevent similar issues in the future.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions