|
| 1 | +file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") |
| 2 | +string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") |
| 3 | + |
| 4 | +if(NOT WITH_DISTRIBUTE) |
| 5 | + list(REMOVE_ITEM TEST_OPS test_recv_op) |
| 6 | +endif(NOT WITH_DISTRIBUTE) |
| 7 | + |
| 8 | +list(REMOVE_ITEM TEST_OPS test_seq_concat_op) # FIXME(helin): https://github.com/PaddlePaddle/Paddle/issues/8290 |
| 9 | +list(REMOVE_ITEM TEST_OPS test_modified_huber_loss_op) # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5184 |
| 10 | +list(REMOVE_ITEM TEST_OPS test_lstm_unit_op) # # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5185 |
| 11 | +list(REMOVE_ITEM TEST_OPS test_nce) # IXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/7778 |
| 12 | +list(REMOVE_ITEM TEST_OPS test_recurrent_op) # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/6152 |
| 13 | +list(REMOVE_ITEM TEST_OPS test_cond_op) # FIXME(qijun): https://github.com/PaddlePaddle/Paddle/issues/5101#issuecomment-339814957 |
| 14 | +list(REMOVE_ITEM TEST_OPS test_detection_output_op) # FIXME: detection_output_op will be rewritten. This unittest should be |
| 15 | + |
| 16 | +list(REMOVE_ITEM TEST_OPS op_test) # op_test is a helper python file, not a test |
| 17 | +list(REMOVE_ITEM TEST_OPS decorators) # decorators is a helper python file, not a test |
| 18 | + |
| 19 | +function(py_test_modules TARGET_NAME) |
| 20 | + if(WITH_TESTING) |
| 21 | + set(options "") |
| 22 | + set(oneValueArgs "") |
| 23 | + set(multiValueArgs MODULES DEPS ARGS ENVS) |
| 24 | + cmake_parse_arguments(py_test_modules "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
| 25 | + add_test(NAME ${TARGET_NAME} |
| 26 | + COMMAND env PYTHONPATH=${PADDLE_PYTHON_BUILD_DIR}/lib-python ${py_test_modules_ENVS} |
| 27 | + ${PYTHON_EXECUTABLE} -u -m unittest --verbose ${py_test_modules_MODULES} ${py_test_modules_ARGS} |
| 28 | + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 29 | + endif() |
| 30 | +endfunction() |
| 31 | + |
| 32 | +# test time consuming OPs in a separate process for expliot parallism |
| 33 | +list(REMOVE_ITEM TEST_OPS test_warpctc_op) |
| 34 | +list(REMOVE_ITEM TEST_OPS test_dyn_rnn) |
| 35 | +list(REMOVE_ITEM TEST_OPS test_mul_op) |
| 36 | + |
| 37 | +# tests that need to be run in separate process. |
| 38 | +list(REMOVE_ITEM TEST_OPS test_multihead_attention) |
| 39 | +list(REMOVE_ITEM TEST_OPS test_calc_gradient) |
| 40 | +list(REMOVE_ITEM TEST_OPS test_while_op) |
| 41 | +list(REMOVE_ITEM TEST_OPS test_lod_array_length_op) |
| 42 | +list(REMOVE_ITEM TEST_OPS test_reorder_lod_tensor) |
| 43 | +list(REMOVE_ITEM TEST_OPS test_profiler) |
| 44 | +list(REMOVE_ITEM TEST_OPS test_normalization_wrapper) |
| 45 | +list(REMOVE_ITEM TEST_OPS test_executor_and_mul) |
| 46 | +list(REMOVE_ITEM TEST_OPS test_assign_value_op) |
| 47 | +list(REMOVE_ITEM TEST_OPS test_array_read_write_op) |
| 48 | +list(REMOVE_ITEM TEST_OPS test_lod_rank_table) |
| 49 | +list(REMOVE_ITEM TEST_OPS test_weight_normalization) |
| 50 | +list(REMOVE_ITEM TEST_OPS test_conditional_block) |
| 51 | +list(REMOVE_ITEM TEST_OPS test_parameter) |
| 52 | +list(REMOVE_ITEM TEST_OPS test_registry) |
| 53 | +list(REMOVE_ITEM TEST_OPS test_fetch_var) |
| 54 | +list(REMOVE_ITEM TEST_OPS test_parallel_op) |
| 55 | +list(REMOVE_ITEM TEST_OPS test_dynrnn_static_input) |
| 56 | + |
| 57 | +# tests that can be bundled together in one python process for speed. |
| 58 | +if(WITH_FAST_BUNDLE_TEST) |
| 59 | + py_test_modules("test_all_ops" MODULES ${TEST_OPS}) |
| 60 | +else() |
| 61 | + foreach(TEST_OP ${TEST_OPS}) |
| 62 | + py_test_modules(${TEST_OP} MODULES ${TEST_OP}) |
| 63 | + endforeach(TEST_OP) |
| 64 | +endif(WITH_FAST_BUNDLE_TEST) |
| 65 | + |
| 66 | +# tests with high overhead |
| 67 | +py_test_modules(test_warpctc_op MODULES test_warpctc_op ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR}) |
| 68 | +py_test_modules(test_train_dyn_rnn MODULES test_dyn_rnn) |
| 69 | +py_test_modules(test_mul_op MODULES test_mul_op) |
| 70 | + |
| 71 | +# tests that need to be run in separate process. |
| 72 | +py_test_modules(test_multihead_attention MODULES test_multihead_attention) |
| 73 | +py_test_modules(test_calc_gradient MODULES test_calc_gradient) |
| 74 | +py_test_modules(test_while_op MODULES test_while_op) |
| 75 | +py_test_modules(test_lod_array_length_op MODULES test_lod_array_length_op) |
| 76 | +py_test_modules(test_reorder_lod_tensor MODULES test_reorder_lod_tensor) |
| 77 | +py_test_modules(test_profiler MODULES test_profiler) |
| 78 | +py_test_modules(test_normalization_wrapper MODULES test_normalization_wrapper) |
| 79 | +py_test_modules(test_executor_and_mul MODULES test_executor_and_mul) |
| 80 | +py_test_modules(test_assign_value_op MODULES test_assign_value_op) |
| 81 | +py_test_modules(test_array_read_write_op MODULES test_array_read_write_op) |
| 82 | +py_test_modules(test_lod_rank_table MODULES test_lod_rank_table) |
| 83 | +py_test_modules(test_weight_normalization MODULES test_weight_normalization) |
| 84 | +py_test_modules(test_conditional_block MODULES test_conditional_block) |
| 85 | +py_test_modules(test_parameter MODULES test_parameter) |
| 86 | +py_test_modules(test_registry MODULES test_registry) |
| 87 | +py_test_modules(test_fetch_var MODULES test_fetch_var) |
| 88 | +py_test_modules(test_dynrnn_static_input MODULES test_dynrnn_static_input) |
| 89 | +py_test_modules(test_parallel_op MODULES test_parallel_op) |
0 commit comments