Skip to content

Commit 58a66d8

Browse files
authored
[Test] Make tests in module_io, module_hsolver and module_cell indenpendent (#6218)
* Make tests in module_io independent * Modify test.yml * Add some missing tests for module_base * Make tests in module_hsolver independent * Modify test.yml * Make tests in module_cell indenpendent * Modify test.yml * Remove some integrated test from Unit test part
1 parent 15bd8c8 commit 58a66d8

23 files changed

+151
-130
lines changed

.github/workflows/test.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,31 @@ jobs:
132132
OMP_NUM_THREADS: '2'
133133
run: |
134134
cmake --build build --target test ARGS="-V --timeout 1700 -R MODULE_BASE"
135+
136+
- name: Module IO Unit Test
137+
env:
138+
GTEST_COLOR: 'yes'
139+
OMP_NUM_THREADS: '2'
140+
run: |
141+
cmake --build build --target test ARGS="-V --timeout 1700 -R MODULE_IO"
142+
143+
- name: Module HSolver Unit Test
144+
env:
145+
GTEST_COLOR: 'yes'
146+
OMP_NUM_THREADS: '2'
147+
run: |
148+
cmake --build build --target test ARGS="-V --timeout 1700 -R MODULE_HSOLVER"
149+
150+
- name: Module Cell Unit Test
151+
env:
152+
GTEST_COLOR: 'yes'
153+
OMP_NUM_THREADS: '2'
154+
run: |
155+
cmake --build build --target test ARGS="-V --timeout 1700 -R MODULE_CELL"
135156
136-
- name: Unit Test
157+
- name: Other Unit Tests
137158
env:
138159
GTEST_COLOR: 'yes'
139160
OMP_NUM_THREADS: '2'
140161
run: |
141-
cmake --build build --target test ARGS="-V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_LJ_DP|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|16_SDFT_GPU'"
162+
cmake --build build --target test ARGS="-V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_LJ_DP|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|12_NAO_Gamma_GPU|13_NAO_multik_GPU|15_rtTDDFT_GPU|16_SDFT_GPU|MODULE_BASE|MODULE_IO|MODULE_HSOLVER|MODULE_CELL'"

source/module_base/test_parallel/CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
AddTest(
2-
TARGET base_ParaCommon
2+
TARGET MODULE_BASE_ParaCommon
33
LIBS parameter MPI::MPI_CXX
44
SOURCES parallel_common_test.cpp ../global_variable.cpp ../parallel_common.cpp
55
)
66

77
AddTest(
8-
TARGET base_ParaGlobal
8+
TARGET MODULE_BASE_ParaGlobal
99
LIBS parameter MPI::MPI_CXX
1010
SOURCES parallel_global_test.cpp ../global_variable.cpp ../parallel_global.cpp ../parallel_comm.cpp
1111
)
1212

1313
AddTest(
14-
TARGET base_ParaReduce
14+
TARGET MODULE_BASE_ParaReduce
1515
LIBS parameter MPI::MPI_CXX
1616
SOURCES parallel_reduce_test.cpp ../global_variable.cpp ../parallel_global.cpp ../parallel_comm.cpp ../parallel_common.cpp ../parallel_reduce.cpp
1717
)
@@ -21,45 +21,45 @@ install(FILES parallel_global_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2121
install(FILES parallel_reduce_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2222

2323
find_program(BASH bash)
24-
add_test(NAME base_parallel_common_test
24+
add_test(NAME MODULE_BASE_parallel_common_test
2525
COMMAND ${BASH} parallel_common_test.sh
2626
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
2727
)
28-
add_test(NAME base_parallel_global_test
28+
add_test(NAME MODULE_BASE_parallel_global_test
2929
COMMAND ${BASH} parallel_global_test.sh
3030
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3131
)
32-
add_test(NAME base_parallel_reduce_test
32+
add_test(NAME MODULE_BASE_parallel_reduce_test
3333
COMMAND ${BASH} parallel_reduce_test.sh
3434
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3535
)
3636

3737
AddTest(
38-
TARGET base_para_gemm
38+
TARGET MODULE_BASE_para_gemm
3939
LIBS MPI::MPI_CXX ${math_libs} base device parameter
4040
SOURCES test_para_gemm.cpp
4141
)
4242

4343
AddTest(
44-
TARGET base_math_chebyshev_mpi
44+
TARGET MODULE_BASE_math_chebyshev_mpi
4545
LIBS MPI::MPI_CXX parameter ${math_libs} base device container
4646
SOURCES math_chebyshev_mpi_test.cpp
4747
)
4848

49-
add_test(NAME base_para_gemm_parallel
50-
COMMAND mpirun -np 4 ./base_para_gemm
49+
add_test(NAME MODULE_BASE_para_gemm_parallel
50+
COMMAND mpirun -np 4 ./MODULE_BASE_para_gemm
5151
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
5252
)
5353

5454
AddTest(
55-
TARGET parallel_2d_test
55+
TARGET MODULE_BASE_parallel_2d_test
5656
SOURCES parallel_2d_test.cpp ../parallel_2d.cpp
5757
LIBS parameter ${math_libs}
5858
)
5959

6060
install(FILES parallel_2d_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
6161
find_program(BASH bash)
62-
add_test(NAME parallel_2d_test_para
62+
add_test(NAME MODULE_BASE_parallel_2d_test_para
6363
COMMAND ${BASH} parallel_2d_test.sh
6464
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
6565
)
@@ -73,12 +73,12 @@ add_test(NAME parallel_2d_test_para
7373
endif()
7474

7575
AddTest(
76-
TARGET blacs_connector
76+
TARGET MODULE_BASE_blacs_connector
7777
LIBS parameter MPI::MPI_CXX ${BLACS_LIB}
7878
SOURCES blacs_connector_test.cpp
7979
)
8080
install(FILES blacs_connector_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
81-
add_test(NAME blacs_connector_test
81+
add_test(NAME MODULE_BASE_blacs_connector_test
8282
COMMAND ${BASH} blacs_connector_test.sh
8383
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8484
)

source/module_base/test_parallel/blacs_connector_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ do
99
continue
1010
fi
1111
echo "TEST in parallel, nprocs=$i"
12-
mpirun -np $i ./blacs_connector
12+
mpirun -np $i ./MODULE_BASE_blacs_connector
1313
if [[ $? -ne 0 ]]; then
1414
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1515
"execute UT with $i cores error."

source/module_base/test_parallel/parallel_2d_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for i in 2 3 4; do
88
continue
99
fi
1010
echo "TEST in parallel, nprocs=$i"
11-
mpirun -np $i ./parallel_2d_test
11+
mpirun -np $i ./MODULE_BASE_parallel_2d_test
1212
if [[ $? -ne 0 ]]; then
1313
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1414
"execute UT with $i cores error."

source/module_base/test_parallel/parallel_common_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for i in 3;do
88
continue
99
fi
1010
echo "TEST in parallel, nprocs=$i"
11-
mpirun -np $i ./base_ParaCommon
11+
mpirun -np $i ./MODULE_BASE_ParaCommon
1212
if [[ $? -ne 0 ]]; then
1313
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1414
"execute UT with $i cores error."

source/module_base/test_parallel/parallel_global_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for i in 4;do
88
continue
99
fi
1010
echo "TEST in parallel, nprocs=$i"
11-
mpirun -np $i ./base_ParaGlobal
11+
mpirun -np $i ./MODULE_BASE_ParaGlobal
1212
if [[ $? -ne 0 ]]; then
1313
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1414
"execute UT with $i cores error."

source/module_base/test_parallel/parallel_reduce_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for i in 4;do
88
continue
99
fi
1010
echo "TEST in parallel, nprocs=$i"
11-
mpirun -np $i ./base_ParaReduce
11+
mpirun -np $i ./MODULE_BASE_ParaReduce
1212
if [[ $? -ne 0 ]]; then
1313
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1414
"execute UT with $i cores error."

source/module_cell/test/CMakeLists.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,106 +39,106 @@ list(APPEND cell_simple_srcs
3939
add_library(cell_info OBJECT ${cell_simple_srcs})
4040

4141
AddTest(
42-
TARGET cell_read_pp
42+
TARGET MODULE_CELL_read_pp
4343
LIBS parameter ${math_libs} base device
4444
SOURCES read_pp_test.cpp ../atom_pseudo.cpp ../pseudo.cpp ../read_pp.cpp ../read_pp_complete.cpp ../read_pp_upf201.cpp ../read_pp_upf100.cpp ../read_pp_vwr.cpp ../read_pp_blps.cpp
4545
../../module_io/output.cpp
4646
)
4747

4848
AddTest(
49-
TARGET cell_pseudo_nc
49+
TARGET MODULE_CELL_pseudo_nc
5050
LIBS parameter ${math_libs} base device
5151
SOURCES pseudo_nc_test.cpp ../pseudo.cpp ../atom_pseudo.cpp ../read_pp.cpp ../read_pp_complete.cpp ../read_pp_upf201.cpp ../read_pp_upf100.cpp ../read_pp_vwr.cpp
5252
../read_pp_blps.cpp ../../module_io/output.cpp
5353
)
5454

5555
AddTest(
56-
TARGET cell_atom_pseudo
56+
TARGET MODULE_CELL_atom_pseudo
5757
LIBS parameter ${math_libs} base device
5858
SOURCES atom_pseudo_test.cpp ../atom_pseudo.cpp ../pseudo.cpp ../read_pp.cpp ../read_pp_complete.cpp ../read_pp_upf201.cpp ../read_pp_upf100.cpp
5959
../read_pp_vwr.cpp ../read_pp_blps.cpp ../../module_io/output.cpp
6060
)
6161

6262
AddTest(
63-
TARGET cell_atom_spec
63+
TARGET MODULE_CELL_atom_spec
6464
LIBS parameter ${math_libs} base device
6565
SOURCES atom_spec_test.cpp ../atom_spec.cpp ../atom_pseudo.cpp ../pseudo.cpp ../read_pp.cpp ../read_pp_complete.cpp ../read_pp_upf201.cpp
6666
../read_pp_upf100.cpp ../read_pp_vwr.cpp ../read_pp_blps.cpp ../../module_io/output.cpp
6767
)
6868

6969
AddTest(
70-
TARGET cell_klist_test
70+
TARGET MODULE_CELL_klist_test
7171
LIBS parameter ${math_libs} base device symmetry
7272
SOURCES klist_test.cpp ../klist.cpp ../parallel_kpoints.cpp ../../module_io/output.cpp
7373
)
7474

7575
AddTest(
76-
TARGET cell_klist_test_para1
76+
TARGET MODULE_CELL_klist_test_para1
7777
LIBS parameter ${math_libs} base device symmetry
7878
SOURCES klist_test_para.cpp ../klist.cpp ../parallel_kpoints.cpp ../../module_io/output.cpp
7979
)
8080

81-
add_test(NAME cell_klist_test_para4
81+
add_test(NAME MODULE_CELL_klist_test_para4
8282
COMMAND ${BASH} klist_test_para.sh
8383
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8484
)
8585

8686
AddTest(
87-
TARGET cell_ParaKpoints
87+
TARGET MODULE_CELL_ParaKpoints
8888
LIBS parameter MPI::MPI_CXX
8989
SOURCES parallel_kpoints_test.cpp ../../module_base/global_variable.cpp ../../module_base/parallel_global.cpp
9090
../../module_base/parallel_common.cpp ../../module_base/parallel_comm.cpp ../parallel_kpoints.cpp
9191
)
9292

9393
find_program(BASH bash)
9494

95-
add_test(NAME cell_bcast_atom_pseudo_test
95+
add_test(NAME MODULE_CELL_bcast_atom_pseudo_test
9696
COMMAND ${BASH} bcast_atom_pseudo_test.sh
9797
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
9898
)
9999

100-
add_test(NAME cell_bcast_atom_spec_test
100+
add_test(NAME MODULE_CELL_bcast_atom_spec_test
101101
COMMAND ${BASH} bcast_atom_spec_test.sh
102102
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
103103
)
104104

105-
add_test(NAME cell_parallel_kpoints_test
105+
add_test(NAME MODULE_CELL_parallel_kpoints_test
106106
COMMAND ${BASH} parallel_kpoints_test.sh
107107
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
108108
)
109109

110110
AddTest(
111-
TARGET cell_unitcell_test
111+
TARGET MODULE_CELL_unitcell_test
112112
LIBS parameter ${math_libs} base device cell_info symmetry
113113
SOURCES unitcell_test.cpp ../../module_io/output.cpp ../../module_elecstate/cal_ux.cpp
114114

115115
)
116116

117117
AddTest(
118-
TARGET cell_unitcell_test_readpp
118+
TARGET MODULE_CELL_unitcell_test_readpp
119119
LIBS parameter ${math_libs} base device cell_info
120120
SOURCES unitcell_test_readpp.cpp ../../module_io/output.cpp
121121
)
122122

123123
AddTest(
124-
TARGET cell_unitcell_test_para
124+
TARGET MODULE_CELL_unitcell_test_para
125125
LIBS parameter ${math_libs} base device cell_info
126126
SOURCES unitcell_test_para.cpp ../../module_io/output.cpp
127127
)
128128

129129
AddTest(
130-
TARGET cell_unitcell_test_setupcell
130+
TARGET MODULE_CELL_unitcell_test_setupcell
131131
LIBS parameter ${math_libs} base device cell_info
132132
SOURCES unitcell_test_setupcell.cpp ../../module_io/output.cpp
133133
)
134134

135-
add_test(NAME cell_unitcell_test_parallel
135+
add_test(NAME MODULE_CELL_unitcell_test_parallel
136136
COMMAND ${BASH} unitcell_test_parallel.sh
137137
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
138138
)
139139

140140
AddTest(
141-
TARGET cell_index_test
141+
TARGET MODULE_CELL_index_test
142142
LIBS parameter ${math_libs} base device
143143
SOURCES cell_index_test.cpp ../cell_index.cpp
144144
)

source/module_cell/test/bcast_atom_pseudo_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for i in 4;do
88
continue
99
fi
1010
echo "TEST in parallel, nprocs=$i"
11-
mpirun -np $i ./cell_atom_pseudo
11+
mpirun -np $i ./MODULE_CELL_atom_pseudo
1212
if [[ $? -ne 0 ]]; then
1313
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1414
"execute UT with $i cores error."

source/module_cell/test/bcast_atom_spec_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for i in 4;do
88
continue
99
fi
1010
echo "TEST in parallel, nprocs=$i"
11-
mpirun -np $i ./cell_atom_spec
11+
mpirun -np $i ./MODULE_CELL_atom_spec
1212
if [[ $? -ne 0 ]]; then
1313
echo -e "\e[1;33m [ FAILED ] \e[0m"\
1414
"execute UT with $i cores error."

0 commit comments

Comments
 (0)