CMakeLists.txt 1.1 KB
Newer Older
1 2 3 4 5 6 7
function(inference_test TARGET_NAME)
  set(options "")
  set(oneValueArgs "")
  set(multiValueArgs ARGS)
  cmake_parse_arguments(inference_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  set(PYTHON_TESTS_DIR ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/tests)
L
Liu Yiqun 已提交
8
  set(arg_list "")
9 10
  if(inference_test_ARGS)
    foreach(arg ${inference_test_ARGS})
L
Liu Yiqun 已提交
11
      list(APPEND arg_list "_${arg}")
12 13
    endforeach()
  else()
L
Liu Yiqun 已提交
14 15 16 17 18
    list(APPEND arg_list "_")
  endif()
  foreach(arg ${arg_list})
    string(REGEX REPLACE "^_$" "" arg "${arg}")
    cc_test(test_inference_${TARGET_NAME}${arg}
19 20
        SRCS test_inference_${TARGET_NAME}.cc
        DEPS ARCHIVE_START paddle_fluid ARCHIVE_END
L
Liu Yiqun 已提交
21 22
        ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}${arg}.inference.model)
    set_tests_properties(test_inference_${TARGET_NAME}${arg}
23
        PROPERTIES DEPENDS test_${TARGET_NAME})
L
Liu Yiqun 已提交
24
  endforeach()
25 26 27 28 29
endfunction(inference_test)

inference_test(recognize_digits ARGS mlp)
inference_test(image_classification ARGS vgg resnet)
inference_test(label_semantic_roles)
K
Kexin Zhao 已提交
30
inference_test(rnn_encoder_decoder)
31
inference_test(recommender_system)