Skip to content

Commit 62559ac

Browse files
authored
Merge pull request #10834 from reyoung/feature/sequnce_run_tests
Force some unittests serial
2 parents 942e219 + 1426d79 commit 62559ac

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

cmake/generic.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ endfunction(cc_binary)
231231

232232
function(cc_test TARGET_NAME)
233233
if(WITH_TESTING)
234-
set(options "")
234+
set(options SERIAL)
235235
set(oneValueArgs "")
236236
set(multiValueArgs SRCS DEPS ARGS)
237237
cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -241,6 +241,9 @@ function(cc_test TARGET_NAME)
241241
add_test(NAME ${TARGET_NAME}
242242
COMMAND ${TARGET_NAME} ${cc_test_ARGS}
243243
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
244+
if (${cc_test_SERIAL})
245+
set_property(TEST ${TARGET_NAME} PROPERTY SERIAL 1)
246+
endif()
244247
endif()
245248
endfunction(cc_test)
246249

@@ -295,14 +298,17 @@ endfunction(nv_binary)
295298

296299
function(nv_test TARGET_NAME)
297300
if (WITH_GPU AND WITH_TESTING)
298-
set(options "")
301+
set(options SERIAL)
299302
set(oneValueArgs "")
300303
set(multiValueArgs SRCS DEPS)
301304
cmake_parse_arguments(nv_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
302305
cuda_add_executable(${TARGET_NAME} ${nv_test_SRCS})
303306
target_link_libraries(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main memory gtest gflags glog)
304307
add_dependencies(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main memory gtest gflags glog)
305308
add_test(${TARGET_NAME} ${TARGET_NAME})
309+
if (nv_test_SERIAL)
310+
set_property(TEST ${TARGET_NAME} PROPERTY SERIAL 1)
311+
endif()
306312
endif()
307313
endfunction(nv_test)
308314

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
nv_test(test_op_converter SRCS test_op_converter.cc mul_op.cc conv2d_op.cc DEPS ${FLUID_CORE_MODULES})
22
nv_test(test_trt_activation_op SRCS test_activation_op.cc activation_op.cc io_converter.cc
3-
DEPS ${FLUID_CORE_MODULES} activation_op tensorrt_engine)
3+
DEPS ${FLUID_CORE_MODULES} activation_op tensorrt_engine
4+
SERIAL)
45
nv_test(test_io_converter SRCS test_io_converter.cc io_converter.cc DEPS dynload_cuda dynamic_loader lod_tensor)

paddle/fluid/operators/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ if(WITH_DISTRIBUTE)
202202
op_library(send_barrier_op DEPS ${DISTRIBUTE_DEPS})
203203
set_source_files_properties(send_barrier_op.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
204204
set_source_files_properties(send_recv_op_test.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
205-
cc_test(test_send_recv SRCS send_recv_op_test.cc DEPS prefetch_op send_op listen_and_serv_op sum_op executor)
205+
cc_test(test_send_recv SRCS send_recv_op_test.cc DEPS prefetch_op send_op
206+
listen_and_serv_op sum_op executor SERIAL)
206207
if(WITH_GPU)
207208
set_source_files_properties(test_send_nccl_id.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
208-
cc_test(test_send_nccl_id SRCS test_send_nccl_id.cc DEPS send_op listen_and_serv_op executor)
209+
cc_test(test_send_nccl_id SRCS test_send_nccl_id.cc DEPS send_op
210+
listen_and_serv_op executor SERIAL)
209211
op_library(gen_nccl_id_op DEPS nccl_common sendrecvop_grpc)
210212
set_source_files_properties(gen_nccl_id_op.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
211213
else()

paddle/fluid/operators/detail/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ if(WITH_DISTRIBUTE)
44
set(DISTRIBUTE_COMPILE_FLAGS "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor")
55
set_source_files_properties(serde_test.cc grpc_server_test.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
66
cc_test(serde_test SRCS serde_test.cc variable_response.cc DEPS grpc++_unsecure grpc_unsecure gpr
7-
cares zlib protobuf sendrecvop_grpc)
8-
cc_test(grpc_server_test SRCS grpc_server_test.cc DEPS sendrecvop_grpc grpc++_unsecure grpc_unsecure gpr cares zlib protobuf executor proto_desc lookup_table_op)
7+
cares zlib protobuf sendrecvop_grpc SERIAL)
8+
cc_test(grpc_server_test SRCS grpc_server_test.cc DEPS sendrecvop_grpc
9+
grpc++_unsecure grpc_unsecure gpr cares zlib protobuf executor
10+
proto_desc lookup_table_op SERIAL)
911
endif()

python/paddle/fluid/tests/unittests/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ list(REMOVE_ITEM TEST_OPS decorators) # decorators is a helper python file, not
2626

2727
function(py_test_modules TARGET_NAME)
2828
if(WITH_TESTING)
29-
set(options "")
29+
set(options SERIAL)
3030
set(oneValueArgs "")
3131
set(multiValueArgs MODULES DEPS ENVS)
3232
cmake_parse_arguments(py_test_modules "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
3333
add_test(NAME ${TARGET_NAME}
3434
COMMAND env PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_modules_ENVS}
3535
${PYTHON_EXECUTABLE} ${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
3636
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
37+
if (py_test_modules_SERIAL)
38+
set_property(TEST ${TARGET_NAME} PROPERTY SERIAL 1)
39+
endif()
3740
endif()
3841
endfunction()
3942

@@ -81,7 +84,7 @@ endif(WITH_FAST_BUNDLE_TEST)
8184
py_test_modules(test_sequence_expand MODULES test_sequence_expand)
8285
# tests with high overhead
8386
py_test_modules(test_parallel_executor MODULES test_parallel_executor)
84-
py_test_modules(test_warpctc_op MODULES test_warpctc_op ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR})
87+
py_test_modules(test_warpctc_op MODULES test_warpctc_op ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR} SERIAL)
8588
py_test_modules(test_train_dyn_rnn MODULES test_dyn_rnn)
8689
py_test_modules(test_mul_op MODULES test_mul_op)
8790
py_test_modules(test_network_with_dtype MODULES test_network_with_dtype)
@@ -106,4 +109,4 @@ py_test_modules(test_registry MODULES test_registry)
106109
py_test_modules(test_fetch_var MODULES test_fetch_var)
107110
py_test_modules(test_dynrnn_static_input MODULES test_dynrnn_static_input)
108111
py_test_modules(test_parallel_op MODULES test_parallel_op)
109-
py_test_modules(test_dist_train MODULES test_dist_train)
112+
py_test_modules(test_dist_train MODULES test_dist_train SERIAL)

0 commit comments

Comments
 (0)