Skip to content

Commit 059cbe7

Browse files
author
abacus_fixer
committed
refactor(source_estate): fold charge_mpi_test into test/, drop test_mpi/
charge_mpi_test is a real MPI test (its main() calls MPI_Init) but does not need a separate directory now that AddTest supports KEEP_FEATURE_DEFINITIONS. Move it into test/ alongside the other module tests, keep __MPI for that target, and register its mpirun -np 4 variant there. Remove the now-empty test_mpi/ subdirectory and its add_subdirectory() call. Verified: ctest -R "MODULE_ESTATE_charge_mpi_test|MODULE_ESTATE_test_rhog_io" -> 3/3 passed (test_rhog_io 10/10, charge_mpi_test, charge_mpi_test_4np 4/4).
1 parent 9a33f39 commit 059cbe7

4 files changed

Lines changed: 14 additions & 19 deletions

File tree

source/source_estate/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ endif()
7575
if(BUILD_TESTING)
7676
if(ENABLE_MPI)
7777
add_subdirectory(test)
78-
add_subdirectory(test_mpi)
7978
endif()
8079
endif()
8180

source/source_estate/test/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,18 @@ AddTest(
126126
KEEP_FEATURE_DEFINITIONS __MPI
127127
)
128128

129+
AddTest(
130+
TARGET MODULE_ESTATE_charge_mpi_test
131+
LIBS parameter psi base device planewave
132+
SOURCES charge_mpi_test.cpp ../module_charge/charge_mpi.cpp
133+
# Real MPI test: its main() calls MPI_Init unconditionally, so it must keep
134+
# __MPI despite this directory disabling it.
135+
KEEP_FEATURE_DEFINITIONS __MPI
136+
)
137+
138+
add_test(NAME MODULE_ESTATE_charge_mpi_test_4np
139+
COMMAND mpirun -np 4 ./MODULE_ESTATE_charge_mpi_test;
140+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
141+
)
142+
129143
endif()
File renamed without changes.

source/source_estate/test_mpi/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)