CMakeLists.txt 1.0 KB
Newer Older
X
Xin Pan 已提交
1 2 3 4 5 6
function(train_test TARGET_NAME)
    set(options "")
    set(oneValueArgs "")
    set(multiValueArgs ARGS)
    cmake_parse_arguments(train_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

7 8 9
    if (NOT APPLE AND NOT WIN32)
        cc_test(test_train_${TARGET_NAME}
                SRCS test_train_${TARGET_NAME}.cc
10
                DEPS paddle_inference_shared
11
                ARGS --dirname=${PYTHON_TESTS_DIR}/book/)
X
Xin Pan 已提交
12
    else()
Q
Qi Li 已提交
13
        cc_test(test_train_${TARGET_NAME}
14
                SRCS test_train_${TARGET_NAME}.cc
15
                DEPS paddle_inference_io
16 17
                ARGS --dirname=${PYTHON_TESTS_DIR}/book/)
    endif()
18
    if(TEST test_train_${TARGET_NAME})
19
        set_tests_properties(test_train_${TARGET_NAME}
20 21 22 23 24
                PROPERTIES FIXTURES_REQUIRED test_${TARGET_NAME}_infer_model)
        if(NOT WIN32 AND NOT APPLE)
            set_tests_properties(test_train_${TARGET_NAME}
                    PROPERTIES TIMEOUT 150)
        endif()
X
Xin Pan 已提交
25 26 27 28
    endif()
endfunction(train_test)


X
Xin Pan 已提交
29
if(WITH_TESTING)
30
  train_test(recognize_digits)
X
Xin Pan 已提交
31
endif()