未验证 提交 02fc1fef 编写于 作者: L LoveAn 提交者: GitHub

Fix the cmake-function named inference_download_and_uncompress on Windows (#26512)

* Fix the cmake-function named inference_download_and_uncompress with Windows, test=develop

* Fix some problems when remove limit of unittests on Windows, test=develop

* Using URL to download file instead of DOWNLOAD_COMMAND. test=develop
上级 06796782
...@@ -64,10 +64,9 @@ if (NOT APPLE AND NOT WIN32) ...@@ -64,10 +64,9 @@ if (NOT APPLE AND NOT WIN32)
SRCS analyzer_tester.cc SRCS analyzer_tester.cc
EXTRA_DEPS reset_tensor_array paddle_fluid_shared EXTRA_DEPS reset_tensor_array paddle_fluid_shared
ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR}) ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR})
elseif(NOT WIN32) elseif(WIN32)
# TODO: Fix this unittest failed on Windows inference_analysis_test(test_analyzer
inference_analysis_test(test_analyzer SRCS analyzer_tester.cc
SRCS analyzer_tester.cc EXTRA_DEPS reset_tensor_array paddle_inference_api
EXTRA_DEPS reset_tensor_array paddle_inference_api ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR})
ARGS --inference_model_dir=${WORD2VEC_MODEL_DIR})
endif() endif()
...@@ -54,8 +54,7 @@ if(WITH_TESTING) ...@@ -54,8 +54,7 @@ if(WITH_TESTING)
ARGS --word2vec_dirname=${WORD2VEC_MODEL_DIR} --book_dirname=${PYTHON_TESTS_DIR}/book) ARGS --word2vec_dirname=${WORD2VEC_MODEL_DIR} --book_dirname=${PYTHON_TESTS_DIR}/book)
set_tests_properties(test_api_impl PROPERTIES DEPENDS test_image_classification) set_tests_properties(test_api_impl PROPERTIES DEPENDS test_image_classification)
set_tests_properties(test_api_impl PROPERTIES LABELS "RUN_TYPE=DIST") set_tests_properties(test_api_impl PROPERTIES LABELS "RUN_TYPE=DIST")
elseif(NOT WIN32) elseif(WIN32)
# TODO: Fix this unittest failed on Windows
inference_base_test(test_api_impl SRCS api_impl_tester.cc DEPS ${inference_deps} inference_base_test(test_api_impl SRCS api_impl_tester.cc DEPS ${inference_deps}
ARGS --word2vec_dirname=${WORD2VEC_MODEL_DIR} --book_dirname=${PYTHON_TESTS_DIR}/book) ARGS --word2vec_dirname=${WORD2VEC_MODEL_DIR} --book_dirname=${PYTHON_TESTS_DIR}/book)
set_tests_properties(test_api_impl PROPERTIES DEPENDS test_image_classification) set_tests_properties(test_api_impl PROPERTIES DEPENDS test_image_classification)
...@@ -67,8 +66,7 @@ endif() ...@@ -67,8 +66,7 @@ endif()
if (NOT APPLE AND NOT WIN32) if (NOT APPLE AND NOT WIN32)
cc_test(test_analysis_predictor SRCS analysis_predictor_tester.cc DEPS paddle_fluid_shared cc_test(test_analysis_predictor SRCS analysis_predictor_tester.cc DEPS paddle_fluid_shared
ARGS --dirname=${WORD2VEC_MODEL_DIR}) ARGS --dirname=${WORD2VEC_MODEL_DIR})
elseif (NOT WIN32) elseif (WIN32)
# TODO: Fix this unittest failed on Windows
cc_test(test_analysis_predictor SRCS analysis_predictor_tester.cc DEPS analysis_predictor benchmark ${inference_deps} cc_test(test_analysis_predictor SRCS analysis_predictor_tester.cc DEPS analysis_predictor benchmark ${inference_deps}
ARGS --dirname=${WORD2VEC_MODEL_DIR}) ARGS --dirname=${WORD2VEC_MODEL_DIR})
endif() endif()
...@@ -32,19 +32,20 @@ function(inference_download_and_uncompress INSTALL_DIR URL FILENAME) ...@@ -32,19 +32,20 @@ function(inference_download_and_uncompress INSTALL_DIR URL FILENAME)
${EXTERNAL_PROJECT_NAME} ${EXTERNAL_PROJECT_NAME}
${EXTERNAL_PROJECT_LOG_ARGS} ${EXTERNAL_PROJECT_LOG_ARGS}
PREFIX ${INSTALL_DIR} PREFIX ${INSTALL_DIR}
DOWNLOAD_COMMAND wget --no-check-certificate -q -O ${INSTALL_DIR}/${FILENAME} ${URL}/${FILENAME} && URL ${URL}/${FILENAME}
${CMAKE_COMMAND} -E tar xzf ${INSTALL_DIR}/${FILENAME}
DOWNLOAD_DIR ${INSTALL_DIR} DOWNLOAD_DIR ${INSTALL_DIR}
DOWNLOAD_NO_EXTRACT 1
DOWNLOAD_NO_PROGRESS 1 DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ${CMAKE_COMMAND} -E chdir ${INSTALL_DIR}
${CMAKE_COMMAND} -E tar xzf ${FILENAME}
UPDATE_COMMAND "" UPDATE_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
endfunction() endfunction()
set(WORD2VEC_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/word2vec") set(WORD2VEC_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/word2vec")
if(NOT EXISTS ${WORD2VEC_INSTALL_DIR} AND NOT WIN32) if(NOT EXISTS ${WORD2VEC_INSTALL_DIR})
inference_download_and_uncompress(${WORD2VEC_INSTALL_DIR} ${INFERENCE_URL} "word2vec.inference.model.tar.gz") inference_download_and_uncompress(${WORD2VEC_INSTALL_DIR} ${INFERENCE_URL} "word2vec.inference.model.tar.gz")
endif() endif()
set(WORD2VEC_MODEL_DIR "${WORD2VEC_INSTALL_DIR}/word2vec.inference.model") set(WORD2VEC_MODEL_DIR "${WORD2VEC_INSTALL_DIR}/word2vec.inference.model")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册