CMakeLists.txt 1.6 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})

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

26
####################
X
Xin Pan 已提交
27 28 29
# 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.
30
####################
Y
Yu Yang 已提交
31 32
# This unittest is buggy!
#inference_test(fit_a_line)
33 34
inference_test(image_classification ARGS vgg resnet)
inference_test(label_semantic_roles)
35
inference_test(recognize_digits ARGS mlp conv)
36
inference_test(recommender_system)
Y
Yu Yang 已提交
37
#inference_test(rnn_encoder_decoder)
C
chengduoZH 已提交
38
#inference_test(understand_sentiment ARGS conv)
39
inference_test(word2vec)
T
tensor-tang 已提交
40 41

# This is an unly work around to make this test run
T
tensor-tang 已提交
42
# TODO(TJ): clean me up
T
tensor-tang 已提交
43 44
cc_test(test_inference_nlp
  SRCS test_inference_nlp.cc
45
  DEPS paddle_fluid_origin
T
tensor-tang 已提交
46
  ARGS
T
tensor-tang 已提交
47
  --model_path=${PADDLE_BINARY_DIR}/python/paddle/fluid/tests/book/recognize_digits_mlp.inference.model)