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

7
  set(PYTHON_TESTS_DIR ${PADDLE_BINARY_DIR}/python/paddle/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
        SRCS test_inference_${TARGET_NAME}.cc
20
        DEPS paddle_fluid
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
endfunction(inference_test)

27
####################
X
Xin Pan 已提交
28 29 30
# Inference tests here depend on fluid/tests/book. If users want to run
# individual test with ctest, they need to run tests in fluid/tests/book
# first to generate saved model.
31
####################
Y
Yu Yang 已提交
32 33
# This unittest is buggy!
#inference_test(fit_a_line)
34 35
inference_test(image_classification ARGS vgg resnet)
inference_test(label_semantic_roles)
36
inference_test(recognize_digits ARGS mlp conv)
37
inference_test(recommender_system)
T
tensor-tang 已提交
38
inference_test(nlp)
Y
Yu Yang 已提交
39
#inference_test(rnn_encoder_decoder)
C
chengduoZH 已提交
40
#inference_test(understand_sentiment ARGS conv)
41
inference_test(word2vec)