CMakeLists.txt 1.6 KB
Newer Older
1 2 3 4 5
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sample_trainer_config.conf
    COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(copy_trainer_conf ALL DEPENDS sample_trainer_config.conf)

6 7
set(PYTHON_PATH 
   ${PADDLE_SOURCE_DIR}/paddle/.set_python_path.sh -d 
X
Xin Pan 已提交
8
   ${PADDLE_BINARY_DIR}/python/:${PADDLE_BINARY_DIR}/paddle/legacy/trainer/tests)
9 10 11 12
function(trainer_test TARGET)
  add_unittest_without_exec(${TARGET} ${TARGET}.cpp)
  add_test(NAME ${TARGET}
    COMMAND ${PYTHON_PATH} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}
13
      WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle/)
14
endfunction()
Z
zhangjinchao01 已提交
15

16 17 18
trainer_test(test_Compare)
trainer_test(test_PyDataProviderWrapper)
trainer_test(test_recurrent_machine_generation)
J
JiabinYang 已提交
19 20 21 22 23
if(NOT APPLE)
  trainer_test(test_Trainer)
else()
  message(WARNING "These tests has been disabled in OSX for random fail: \n test_Trainer") 
endif()
Z
zhangjinchao01 已提交
24 25

############### test_TrainerOnePass ##########################
26 27 28 29 30 31
if(WITH_PYTHON)
  # only run test_TrainerOnePass when PYTHON is enabled, because train one pass
  # is using PyDataProvider2.
  add_unittest_without_exec(test_TrainerOnePass
      test_TrainerOnePass.cpp)
  add_test(NAME test_TrainerOnePass
L
Luo Tao 已提交
32 33
    COMMAND ${PYTHON_PATH} ${PADDLE_SOURCE_DIR}/paddle/.set_port.sh -p port 
          ${CMAKE_CURRENT_BINARY_DIR}/test_TrainerOnePass
34
      WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle/)
35
endif()
Z
zhangjinchao01 已提交
36 37 38

#################### test_config_parser #########################
add_test(NAME test_config_parser
L
Luo Tao 已提交
39
  COMMAND ${PYTHON_PATH} ${PYTHON_EXECUTABLE} 
X
Xin Pan 已提交
40
        ${PADDLE_SOURCE_DIR}/paddle/legacy/trainer/tests/config_parser_test.py
41
    WORKING_DIRECTORY ${PADDLE_BINARY_DIR}/paddle/)