From ae6bb78790648a88df727fab51cc47682bf85438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:13:49 +0800 Subject: [PATCH 1/7] Update CMakeLists.txt --- paddle/fluid/inference/api/details/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/paddle/fluid/inference/api/details/CMakeLists.txt b/paddle/fluid/inference/api/details/CMakeLists.txt index b7eb0030155b7..4a2b2446ee2b4 100644 --- a/paddle/fluid/inference/api/details/CMakeLists.txt +++ b/paddle/fluid/inference/api/details/CMakeLists.txt @@ -37,10 +37,7 @@ else() DEPS phi common) endif() -cc_test( - zero_copy_tensor_test - SRCS zero_copy_tensor_test.cc - DEPS paddle_inference_api) +paddle_test(zero_copy_tensor_test SRCS zero_copy_tensor_test.cc) if(WITH_ONNXRUNTIME AND WIN32) # Copy onnxruntime for some c++ test in Windows, since the test will From 2851f7d3bd5462af87cc898f7bb08fd30d4bbc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:11:46 +0800 Subject: [PATCH 2/7] Update CMakeLists.txt --- paddle/fluid/inference/api/details/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/fluid/inference/api/details/CMakeLists.txt b/paddle/fluid/inference/api/details/CMakeLists.txt index 4a2b2446ee2b4..81290629d3cca 100644 --- a/paddle/fluid/inference/api/details/CMakeLists.txt +++ b/paddle/fluid/inference/api/details/CMakeLists.txt @@ -37,7 +37,7 @@ else() DEPS phi common) endif() -paddle_test(zero_copy_tensor_test SRCS zero_copy_tensor_test.cc) +inference_base_test(zero_copy_tensor_test SRCS zero_copy_tensor_test.cc DEPS paddle_inference_api ARGS --dirname=${WORD2VEC_MODEL_DIR}) if(WITH_ONNXRUNTIME AND WIN32) # Copy onnxruntime for some c++ test in Windows, since the test will From 23202adae548074592c86901664da2a587ec159c Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Thu, 22 Feb 2024 20:39:50 +0800 Subject: [PATCH 3/7] mv cc file --- .../inference/api/details/CMakeLists.txt | 8 ----- test/cpp/inference/api/CMakeLists.txt | 2 ++ test/cpp/inference/api/details/CMakeLists.txt | 29 +++++++++++++++++++ .../api/details/zero_copy_tensor_test.cc | 0 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 test/cpp/inference/api/details/CMakeLists.txt rename {paddle/fluid => test/cpp}/inference/api/details/zero_copy_tensor_test.cc (100%) diff --git a/paddle/fluid/inference/api/details/CMakeLists.txt b/paddle/fluid/inference/api/details/CMakeLists.txt index 81290629d3cca..e200875882440 100644 --- a/paddle/fluid/inference/api/details/CMakeLists.txt +++ b/paddle/fluid/inference/api/details/CMakeLists.txt @@ -36,11 +36,3 @@ else() SRCS zero_copy_tensor_dummy.cc DEPS phi common) endif() - -inference_base_test(zero_copy_tensor_test SRCS zero_copy_tensor_test.cc DEPS paddle_inference_api ARGS --dirname=${WORD2VEC_MODEL_DIR}) - -if(WITH_ONNXRUNTIME AND WIN32) - # Copy onnxruntime for some c++ test in Windows, since the test will - # be build only in CI, so suppose the generator in Windows is Ninja. - copy_onnx(zero_copy_tensor_test) -endif() diff --git a/test/cpp/inference/api/CMakeLists.txt b/test/cpp/inference/api/CMakeLists.txt index ffb306df0810d..5176caf71ad19 100644 --- a/test/cpp/inference/api/CMakeLists.txt +++ b/test/cpp/inference/api/CMakeLists.txt @@ -1514,3 +1514,5 @@ if(WITH_TESTING AND WITH_INFERENCE_API_TEST) endif() endif() endif() + +add_subdirectory(details) diff --git a/test/cpp/inference/api/details/CMakeLists.txt b/test/cpp/inference/api/details/CMakeLists.txt new file mode 100644 index 0000000000000..bd20548570303 --- /dev/null +++ b/test/cpp/inference/api/details/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +inference_base_test( + zero_copy_tensor_test + SRCS + zero_copy_tensor_test.cc + DEPS + paddle_inference_api + ARGS + --dirname=${WORD2VEC_MODEL_DIR}) + +if(WITH_ONNXRUNTIME AND WIN32) + # Copy onnxruntime for some c++ test in Windows, since the test will + # be build only in CI, so suppose the generator in Windows is Ninja. + copy_onnx(zero_copy_tensor_test) +endif() diff --git a/paddle/fluid/inference/api/details/zero_copy_tensor_test.cc b/test/cpp/inference/api/details/zero_copy_tensor_test.cc similarity index 100% rename from paddle/fluid/inference/api/details/zero_copy_tensor_test.cc rename to test/cpp/inference/api/details/zero_copy_tensor_test.cc From 7c753e60476d9df13865f770bd2b89766c44b782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Fri, 23 Feb 2024 22:24:58 +0800 Subject: [PATCH 4/7] Apply suggestions from code review --- test/cpp/inference/api/details/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/inference/api/details/CMakeLists.txt b/test/cpp/inference/api/details/CMakeLists.txt index bd20548570303..017438b967372 100644 --- a/test/cpp/inference/api/details/CMakeLists.txt +++ b/test/cpp/inference/api/details/CMakeLists.txt @@ -19,6 +19,7 @@ inference_base_test( zero_copy_tensor_test.cc DEPS paddle_inference_api + paddle_inference_shared ARGS --dirname=${WORD2VEC_MODEL_DIR}) From 50c770ac56fe579d980f30c610b1f8b96776f519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sat, 24 Feb 2024 07:33:51 +0800 Subject: [PATCH 5/7] Apply suggestions from code review --- test/cpp/inference/api/details/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/cpp/inference/api/details/CMakeLists.txt b/test/cpp/inference/api/details/CMakeLists.txt index 017438b967372..0ed737b3ffc2d 100644 --- a/test/cpp/inference/api/details/CMakeLists.txt +++ b/test/cpp/inference/api/details/CMakeLists.txt @@ -18,7 +18,6 @@ inference_base_test( SRCS zero_copy_tensor_test.cc DEPS - paddle_inference_api paddle_inference_shared ARGS --dirname=${WORD2VEC_MODEL_DIR}) From 7c6c43898beffa741ba01396c2a1e6d2a1533c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:14:39 +0800 Subject: [PATCH 6/7] Apply suggestions from code review --- test/cpp/inference/api/details/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/inference/api/details/CMakeLists.txt b/test/cpp/inference/api/details/CMakeLists.txt index 0ed737b3ffc2d..733c161dcfada 100644 --- a/test/cpp/inference/api/details/CMakeLists.txt +++ b/test/cpp/inference/api/details/CMakeLists.txt @@ -18,6 +18,7 @@ inference_base_test( SRCS zero_copy_tensor_test.cc DEPS + common paddle_inference_shared ARGS --dirname=${WORD2VEC_MODEL_DIR}) From 0cf052144ec9a25b4de45ff7994529ff206b7f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:29:41 +0800 Subject: [PATCH 7/7] Update test.cmake --- test/cpp/inference/test.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/inference/test.cmake b/test/cpp/inference/test.cmake index 50640a9988190..fcda500be733e 100644 --- a/test/cpp/inference/test.cmake +++ b/test/cpp/inference/test.cmake @@ -156,7 +156,7 @@ function(inference_base_test_build TARGET) if(APPLE) target_link_libraries( ${TARGET} - "-Wl,-rpath,$ -Wl,-rpath,$ -Wl,-rpath,$" + "-Wl,-rpath,$ -Wl,-rpath,$ -Wl,-rpath,$ -Wl,-rpath,../.." ) endif() target_link_libraries(${TARGET} ${base_test_DEPS} paddle_gtest_main_new gtest