Skip to content

Commit 601617a

Browse files
houj04co63oc
authored andcommitted
split test.cmake: add new test_cases.cmake (PaddlePaddle#64007)
1 parent d24270f commit 601617a

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed

test/cpp/inference/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
add_definitions(-DPADDLE_DLL_EXPORT)
22
if(WITH_TESTING)
33
include(test.cmake) # some generic cmake function for inference
4+
include(test_cases.cmake)
45
endif()
56

67
add_subdirectory(analysis)

test/cpp/inference/test.cmake

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,35 +73,6 @@ function(inference_download_and_uncompress_without_verify INSTALL_DIR URL
7373
INSTALL_COMMAND "")
7474
endfunction()
7575

76-
set(WORD2VEC_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/word2vec")
77-
if(NOT EXISTS ${WORD2VEC_INSTALL_DIR}/word2vec.inference.model.tar.gz)
78-
inference_download_and_uncompress_without_verify(
79-
${WORD2VEC_INSTALL_DIR} ${INFERENCE_URL} "word2vec.inference.model.tar.gz")
80-
endif()
81-
set(WORD2VEC_MODEL_DIR "${WORD2VEC_INSTALL_DIR}/word2vec.inference.model")
82-
83-
set(IMG_CLS_RESNET_INSTALL_DIR
84-
"${INFERENCE_DEMO_INSTALL_DIR}/image_classification_resnet")
85-
if(NOT EXISTS
86-
${IMG_CLS_RESNET_INSTALL_DIR}/image_classification_resnet.inference.model.tgz
87-
)
88-
inference_download_and_uncompress_without_verify(
89-
${IMG_CLS_RESNET_INSTALL_DIR} ${INFERENCE_URL}
90-
"image_classification_resnet.inference.model.tgz")
91-
endif()
92-
set(IMG_CLS_RESNET_MODEL_DIR
93-
"${IMG_CLS_RESNET_INSTALL_DIR}/image_classification_resnet.inference.model")
94-
95-
if(WITH_ONNXRUNTIME)
96-
set(MOBILENETV2_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/MobileNetV2")
97-
if(NOT EXISTS ${MOBILENETV2_INSTALL_DIR}/MobileNetV2.inference.model.tar.gz)
98-
inference_download_and_uncompress_without_verify(
99-
${MOBILENETV2_INSTALL_DIR} ${INFERENCE_URL}
100-
"MobileNetV2.inference.model.tar.gz")
101-
endif()
102-
set(MOBILENETV2_MODEL_DIR "${MOBILENETV2_INSTALL_DIR}/MobileNetV2")
103-
endif()
104-
10576
function(inference_base_test_build TARGET)
10677
set(options "")
10778
set(oneValueArgs "")
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
include(test.cmake) # some generic cmake function for inference
2+
3+
set(WORD2VEC_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/word2vec")
4+
5+
if(NOT EXISTS ${WORD2VEC_INSTALL_DIR}/word2vec.inference.model.tar.gz)
6+
inference_download_and_uncompress_without_verify(
7+
${WORD2VEC_INSTALL_DIR} ${INFERENCE_URL} "word2vec.inference.model.tar.gz")
8+
endif()
9+
10+
set(WORD2VEC_MODEL_DIR "${WORD2VEC_INSTALL_DIR}/word2vec.inference.model")
11+
12+
set(IMG_CLS_RESNET_INSTALL_DIR
13+
"${INFERENCE_DEMO_INSTALL_DIR}/image_classification_resnet")
14+
15+
if(NOT EXISTS
16+
${IMG_CLS_RESNET_INSTALL_DIR}/image_classification_resnet.inference.model.tgz
17+
)
18+
inference_download_and_uncompress_without_verify(
19+
${IMG_CLS_RESNET_INSTALL_DIR} ${INFERENCE_URL}
20+
"image_classification_resnet.inference.model.tgz")
21+
endif()
22+
23+
set(IMG_CLS_RESNET_MODEL_DIR
24+
"${IMG_CLS_RESNET_INSTALL_DIR}/image_classification_resnet.inference.model")
25+
26+
if(WITH_ONNXRUNTIME)
27+
set(MOBILENETV2_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/MobileNetV2")
28+
if(NOT EXISTS ${MOBILENETV2_INSTALL_DIR}/MobileNetV2.inference.model.tar.gz)
29+
inference_download_and_uncompress_without_verify(
30+
${MOBILENETV2_INSTALL_DIR} ${INFERENCE_URL}
31+
"MobileNetV2.inference.model.tar.gz")
32+
endif()
33+
set(MOBILENETV2_MODEL_DIR "${MOBILENETV2_INSTALL_DIR}/MobileNetV2")
34+
endif()

test/quantization/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
if(ON_INFER)
2-
include(../cpp/inference/test.cmake)
3-
endif()
1+
include(../cpp/inference/test.cmake)
42
file(
53
GLOB TEST_OPS
64
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"

0 commit comments

Comments
 (0)