CMakeLists.txt 1.8 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_api
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 23
            PROPERTIES DEPENDS test_${TARGET_NAME})
    set_tests_properties(test_inference_${TARGET_NAME}${arg}
24
            PROPERTIES LABELS "RUN_TYPE=DIST")
L
Liu Yiqun 已提交
25
  endforeach()
26 27
endfunction(inference_test)

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

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