提交 966e89cd 编写于 作者: Y Yu Yang

Disable some unit tests when PYTHON or SWIG_PY are not enabled.

* When SWIG_PY is not enabled, paddle.v2 package cannot be used.
* When PYTHON is not enabled, PyDataProvider cannot be used.

Fix issue #1920
上级 beabc54d
...@@ -17,14 +17,17 @@ add_test(NAME test_Trainer ...@@ -17,14 +17,17 @@ add_test(NAME test_Trainer
WORKING_DIRECTORY ${PROJ_ROOT}/paddle/) WORKING_DIRECTORY ${PROJ_ROOT}/paddle/)
############### test_TrainerOnePass ########################## ############### test_TrainerOnePass ##########################
add_unittest_without_exec(test_TrainerOnePass if(WITH_PYTHON)
test_TrainerOnePass.cpp) # only run test_TrainerOnePass when PYTHON is enabled, because train one pass
add_test(NAME test_TrainerOnePass # is using PyDataProvider2.
COMMAND ${PROJ_ROOT}/paddle/.set_python_path.sh -d add_unittest_without_exec(test_TrainerOnePass
${PROJ_ROOT}/python/:${PROJ_ROOT}/paddle/trainer/tests test_TrainerOnePass.cpp)
${PROJ_ROOT}/paddle/.set_port.sh -p port ${CMAKE_CURRENT_BINARY_DIR}/test_TrainerOnePass add_test(NAME test_TrainerOnePass
WORKING_DIRECTORY ${PROJ_ROOT}/paddle/) COMMAND ${PROJ_ROOT}/paddle/.set_python_path.sh -d
${PROJ_ROOT}/python/:${PROJ_ROOT}/paddle/trainer/tests
${PROJ_ROOT}/paddle/.set_port.sh -p port ${CMAKE_CURRENT_BINARY_DIR}/test_TrainerOnePass
WORKING_DIRECTORY ${PROJ_ROOT}/paddle/)
endif()
################ test_CompareTwoNets ###################### ################ test_CompareTwoNets ######################
add_unittest_without_exec(test_CompareTwoNets add_unittest_without_exec(test_CompareTwoNets
test_CompareTwoNets.cpp) test_CompareTwoNets.cpp)
......
...@@ -24,9 +24,12 @@ add_custom_target(paddle_python ALL DEPENDS ...@@ -24,9 +24,12 @@ add_custom_target(paddle_python ALL DEPENDS
${OUTPUT_DIR}/.timestamp) ${OUTPUT_DIR}/.timestamp)
add_subdirectory(paddle/trainer_config_helpers/tests) add_subdirectory(paddle/trainer_config_helpers/tests)
add_subdirectory(paddle/v2/tests) if (WITH_SWIG_PY)
add_subdirectory(paddle/v2/reader/tests) # enable v2 API unittest only when paddle swig api is compiled
add_subdirectory(paddle/v2/plot/tests) add_subdirectory(paddle/v2/tests)
add_subdirectory(paddle/v2/reader/tests)
add_subdirectory(paddle/v2/plot/tests)
endif()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/
DESTINATION opt/paddle/share/wheels DESTINATION opt/paddle/share/wheels
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册