未验证 提交 e808fa30 编写于 作者: T tianshuo78520a 提交者: GitHub

Mv phi and fluid/test To test dir (#50640)

上级 cd168502
...@@ -703,6 +703,7 @@ add_subdirectory(paddle) ...@@ -703,6 +703,7 @@ add_subdirectory(paddle)
if(WITH_PYTHON) if(WITH_PYTHON)
add_subdirectory(python) add_subdirectory(python)
endif() endif()
add_subdirectory(test)
get_directory_property(all_inc_dirs INCLUDE_DIRECTORIES) get_directory_property(all_inc_dirs INCLUDE_DIRECTORIES)
list(JOIN all_inc_dirs "\r\n" all_inc_dirs) list(JOIN all_inc_dirs "\r\n" all_inc_dirs)
......
set(CC_TESTS_DIR
${PADDLE_BINARY_DIR}/paddle/tests
CACHE INTERNAL "c++ tests directory")
set(PYTHON_TESTS_DIR set(PYTHON_TESTS_DIR
${PADDLE_BINARY_DIR}/python/paddle/fluid/tests ${PADDLE_BINARY_DIR}/python/paddle/fluid/tests
CACHE INTERNAL "python tests directory") CACHE INTERNAL "python tests directory")
...@@ -36,105 +33,3 @@ add_subdirectory(ir) ...@@ -36,105 +33,3 @@ add_subdirectory(ir)
# (2) naturally, and configure tests in only one `CMakeLists.txt`, # (2) naturally, and configure tests in only one `CMakeLists.txt`,
# (3) cc tests support linking pre-built dynamic libraries. For example, use the dynamic # (3) cc tests support linking pre-built dynamic libraries. For example, use the dynamic
# library in the installed paddle by `pip`. # library in the installed paddle by `pip`.
# add all tests here
get_property(test_srcs GLOBAL PROPERTY TEST_SRCS)
get_property(test_names GLOBAL PROPERTY TEST_NAMES)
# message("test_srcs ${test_srcs}")
get_property(paddle_lib GLOBAL PROPERTY PADDLE_LIB_NAME)
set(POSTFIX ".so")
if(WIN32)
set(POSTFIX ".dll")
endif()
list(LENGTH test_names len)
if(${len} GREATER_EQUAL 1)
message("Total cpp tests using dynamic link: ${len}")
math(EXPR stop "${len} - 1")
foreach(idx RANGE ${stop})
if(WITH_TESTING)
list(GET test_srcs ${idx} test_src)
list(GET test_names ${idx} test_name)
get_property(test_arg GLOBAL PROPERTY "${test_name}_ARGS")
# message("add test ${test_name}")
add_executable(${test_name} ${test_src})
target_link_libraries(${test_name} paddle_gtest_main_new)
target_link_libraries(${test_name} $<TARGET_LINKER_FILE:${paddle_lib}>)
add_dependencies(${test_name} ${paddle_lib} paddle_gtest_main_new)
if(WITH_GPU)
target_link_libraries(${test_name} ${CUDA_CUDART_LIBRARY}
"-Wl,--as-needed")
endif()
if(WITH_ROCM)
target_link_libraries(${test_name} ${ROCM_HIPRTC_LIB})
endif()
if(APPLE)
target_link_libraries(${test_name}
"-Wl,-rpath,$<TARGET_FILE_DIR:${paddle_lib}>")
endif()
if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
target_link_libraries(${test_name} ${PYTHON_LIBRARIES})
endif()
if(WITH_XPU)
target_link_libraries(${test_name} xpulib)
endif()
if(WITH_MLU)
target_link_libraries(${test_name} neuware_lib)
endif()
if(NOT
("${test_name}" STREQUAL "c_broadcast_op_npu_test"
OR "${test_name}" STREQUAL "c_allreduce_sum_op_npu_test"
OR "${test_name}" STREQUAL "c_allreduce_max_op_npu_test"
OR "${test_name}" STREQUAL "c_reducescatter_op_npu_test"
OR "${test_name}" STREQUAL "c_allgather_op_npu_test"
OR "${test_name}" STREQUAL "send_v2_op_npu_test"
OR "${test_name}" STREQUAL "c_reduce_sum_op_npu_test"
OR "${test_name}" STREQUAL "recv_v2_op_npu_test"))
cc_test_run(
${test_name}
COMMAND
${test_name}
ARGS
${test_arg}
DIR
${CC_TESTS_DIR})
endif()
elseif(WITH_TESTING AND NOT TEST ${test_name})
add_test(NAME ${test_name} COMMAND ${CMAKE_COMMAND} -E echo CI skip
${test_name}.)
endif()
set_target_properties(${test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${CC_TESTS_DIR}")
endforeach()
endif()
# set properties for some tests, it should be set after the tests defined.
if(TARGET standalone_executor_test)
set_tests_properties(standalone_executor_test PROPERTIES TIMEOUT 100)
if(NOT WIN32)
add_dependencies(standalone_executor_test download_program)
endif()
endif()
if(TARGET layer_test)
add_dependencies(layer_test jit_download_program)
add_dependencies(layer_test_new jit_download_program)
set_tests_properties(layer_test_new PROPERTIES ENVIRONMENT
"FLAGS_jit_engine_type=New")
endif()
if(TEST buddy_allocator_test)
if(NOT WIN32)
add_dependencies(buddy_allocator_test download_data)
endif()
set_tests_properties(buddy_allocator_test PROPERTIES LABELS
"RUN_TYPE=EXCLUSIVE")
endif()
add_custom_target(build_tests)
# add target to build all cpp tests
if(${len} GREATER_EQUAL 1)
add_dependencies(build_tests ${test_names})
endif()
...@@ -17,53 +17,3 @@ cc_library( ...@@ -17,53 +17,3 @@ cc_library(
staticgraph_executor_statistics staticgraph_executor_statistics
SRCS executor_statistics.cc SRCS executor_statistics.cc
DEPS enforce glog phi_os_info) DEPS enforce glog phi_os_info)
# skip win32 since wget is not installed by default on windows machine.
if(WITH_GPU
AND WITH_TESTING
AND NOT WIN32)
add_custom_target(
download_program
COMMAND wget -nc --no-check-certificate
https://paddle-ci.gz.bcebos.com/new_exec/lm_main_program
COMMAND wget -nc --no-check-certificate
https://paddle-ci.gz.bcebos.com/new_exec/lm_startup_program
WORKING_DIRECTORY "${CC_TESTS_DIR}")
# all operators used in the program
set(OPS
fill_constant_op
uniform_random_op
lookup_table_op
transpose_op
reshape_op
split_op
slice_op
concat_op
matmul_op
elementwise_add_op
elementwise_mul_op
softmax_with_cross_entropy_op
reduce_mean_op
reduce_sum_op
activation_op
sum_op
elementwise_max_op
elementwise_div_op
sgd_op
squared_l2_norm_op
memcpy_h2d_op
memcpy_d2h_op
fetch_v2_op)
# All deps of the operators above, part of GLOB_OPERATOR_DEPS.
set(OP_DEPS generator softmax selected_rows_functor jit_kernel_helper
concat_and_split cross_entropy)
cc_test(standalone_executor_test SRCS standalone_executor_test.cc)
# add_dependencies(standalone_executor_test download_program)
# if(WITH_PROFILER)
# target_link_libraries(standalone_executor_test profiler)
# add_dependencies(standalone_executor_test profiler)
# endif()
endif()
...@@ -47,38 +47,3 @@ cc_library( ...@@ -47,38 +47,3 @@ cc_library(
jit_interpreter_engine jit_interpreter_engine
jit_predictor_engine jit_predictor_engine
jit_function) jit_function)
if(WITH_TESTING AND NOT WIN32)
add_custom_target(
jit_download_program
COMMAND
wget -nc -q --no-check-certificate
https://paddle-ci.gz.bcebos.com/dy2st/multi_program_load_with_property.tar.gz
COMMAND tar zxf multi_program_load_with_property.tar.gz
WORKING_DIRECTORY "${CC_TESTS_DIR}")
set(JIT_DEPS
phi
phi_api
elementwise_add_op
matmul_v2_op
activation_op
reduce_mean_op
feed_op
fetch_op
generated_op
transfer_layout_op
jit_layer)
cc_test(
layer_test
SRCS layer_test.cc
DEPS ${JIT_DEPS})
# add_dependencies(layer_test jit_download_program)
cc_test(
layer_test_new
SRCS layer_test.cc
DEPS ${JIT_DEPS})
# add_dependencies(layer_test_new jit_download_program)
# set_tests_properties(layer_test_new PROPERTIES ENVIRONMENT
# "FLAGS_jit_engine_type=New")
endif()
...@@ -17,8 +17,6 @@ add_subdirectory(kernels) ...@@ -17,8 +17,6 @@ add_subdirectory(kernels)
add_subdirectory(infermeta) add_subdirectory(infermeta)
# phi tools # phi tools
add_subdirectory(tools) add_subdirectory(tools)
# phi tests
add_subdirectory(tests)
# phi capi # phi capi
if(WITH_CUSTOM_DEVICE) if(WITH_CUSTOM_DEVICE)
add_subdirectory(capi) add_subdirectory(capi)
......
...@@ -99,6 +99,8 @@ if(WIN32) ...@@ -99,6 +99,8 @@ if(WIN32)
COMMAND COMMAND
${CMAKE_COMMAND} -E copy_directory ${PADDLE_SOURCE_DIR}/python/paddle ${CMAKE_COMMAND} -E copy_directory ${PADDLE_SOURCE_DIR}/python/paddle
${PADDLE_BINARY_DIR}/python/paddle/ ${PADDLE_BINARY_DIR}/python/paddle/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PADDLE_SOURCE_DIR}/test
${PADDLE_BINARY_DIR}/test
COMMENT "Packing whl packages------>>>" COMMENT "Packing whl packages------>>>"
DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto
pass_desc_py_proto ${PY_FILES}) pass_desc_py_proto ${PY_FILES})
...@@ -108,6 +110,8 @@ if(WIN32) ...@@ -108,6 +110,8 @@ if(WIN32)
COMMAND COMMAND
${CMAKE_COMMAND} -E copy_directory ${PADDLE_SOURCE_DIR}/python/paddle ${CMAKE_COMMAND} -E copy_directory ${PADDLE_SOURCE_DIR}/python/paddle
${PADDLE_BINARY_DIR}/python/paddle/ ${PADDLE_BINARY_DIR}/python/paddle/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PADDLE_SOURCE_DIR}/test
${PADDLE_BINARY_DIR}/test
COMMAND ${CMAKE_COMMAND} -E env ${py_env} ${PYTHON_EXECUTABLE} setup.py COMMAND ${CMAKE_COMMAND} -E env ${py_env} ${PYTHON_EXECUTABLE} setup.py
bdist_wheel bdist_wheel
COMMENT "Packing whl packages------>>>" COMMENT "Packing whl packages------>>>"
...@@ -121,6 +125,7 @@ else() ...@@ -121,6 +125,7 @@ else()
COMMAND touch stub.cc COMMAND touch stub.cc
COMMAND cp -r ${PADDLE_SOURCE_DIR}/python/paddle COMMAND cp -r ${PADDLE_SOURCE_DIR}/python/paddle
${PADDLE_BINARY_DIR}/python ${PADDLE_BINARY_DIR}/python
COMMAND cp -r ${PADDLE_SOURCE_DIR}/test ${PADDLE_BINARY_DIR}/
COMMENT "Packing whl packages------>>>" COMMENT "Packing whl packages------>>>"
DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto
pass_desc_py_proto ${PY_FILES}) pass_desc_py_proto ${PY_FILES})
...@@ -130,6 +135,7 @@ else() ...@@ -130,6 +135,7 @@ else()
COMMAND touch stub.cc COMMAND touch stub.cc
COMMAND cp -r ${PADDLE_SOURCE_DIR}/python/paddle COMMAND cp -r ${PADDLE_SOURCE_DIR}/python/paddle
${PADDLE_BINARY_DIR}/python ${PADDLE_BINARY_DIR}/python
COMMAND cp -r ${PADDLE_SOURCE_DIR}/test ${PADDLE_BINARY_DIR}/
COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py bdist_wheel COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py bdist_wheel
COMMENT "Packing whl packages------>>>" COMMENT "Packing whl packages------>>>"
DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto
......
set(CC_TESTS_DIR
${PADDLE_BINARY_DIR}/test/cpp
CACHE INTERNAL "c++ tests directory")
set(PYTHON_TESTS_DIR
${PADDLE_BINARY_DIR}/test
CACHE INTERNAL "python tests directory")
add_subdirectory(cpp)
add_subdirectory(legacy_test)
get_property(test_srcs GLOBAL PROPERTY TEST_SRCS)
get_property(test_names GLOBAL PROPERTY TEST_NAMES)
get_property(paddle_lib GLOBAL PROPERTY PADDLE_LIB_NAME)
set(POSTFIX ".so")
if(WIN32)
set(POSTFIX ".dll")
endif()
list(LENGTH test_names len)
if(${len} GREATER_EQUAL 1)
message("Total cpp tests using dynamic link: ${len}")
math(EXPR stop "${len} - 1")
foreach(idx RANGE ${stop})
if(WITH_TESTING)
list(GET test_srcs ${idx} test_src)
list(GET test_names ${idx} test_name)
get_property(test_arg GLOBAL PROPERTY "${test_name}_ARGS")
# message("add test ${test_name}")
add_executable(${test_name} ${test_src})
target_link_libraries(${test_name} paddle_gtest_main_new)
target_link_libraries(${test_name} $<TARGET_LINKER_FILE:${paddle_lib}>)
add_dependencies(${test_name} ${paddle_lib} paddle_gtest_main_new)
if(WITH_GPU)
target_link_libraries(${test_name} ${CUDA_CUDART_LIBRARY}
"-Wl,--as-needed")
endif()
if(WITH_ROCM)
target_link_libraries(${test_name} ${ROCM_HIPRTC_LIB})
endif()
if(APPLE)
target_link_libraries(${test_name}
"-Wl,-rpath,$<TARGET_FILE_DIR:${paddle_lib}>")
endif()
if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
target_link_libraries(${test_name} ${PYTHON_LIBRARIES})
endif()
if(WITH_XPU)
target_link_libraries(${test_name} xpulib)
endif()
if(WITH_MLU)
target_link_libraries(${test_name} neuware_lib)
endif()
if(NOT
("${test_name}" STREQUAL "c_broadcast_op_npu_test"
OR "${test_name}" STREQUAL "c_allreduce_sum_op_npu_test"
OR "${test_name}" STREQUAL "c_allreduce_max_op_npu_test"
OR "${test_name}" STREQUAL "c_reducescatter_op_npu_test"
OR "${test_name}" STREQUAL "c_allgather_op_npu_test"
OR "${test_name}" STREQUAL "send_v2_op_npu_test"
OR "${test_name}" STREQUAL "c_reduce_sum_op_npu_test"
OR "${test_name}" STREQUAL "recv_v2_op_npu_test"))
cc_test_run(
${test_name}
COMMAND
${test_name}
ARGS
${test_arg}
DIR
${CC_TESTS_DIR})
endif()
elseif(WITH_TESTING AND NOT TEST ${test_name})
add_test(NAME ${test_name} COMMAND ${CMAKE_COMMAND} -E echo CI skip
${test_name}.)
endif()
set_target_properties(${test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${CC_TESTS_DIR}")
endforeach()
endif()
# set properties for some tests, it should be set after the tests defined.
if(TARGET standalone_executor_test)
set_tests_properties(standalone_executor_test PROPERTIES TIMEOUT 100)
if(NOT WIN32)
add_dependencies(standalone_executor_test download_program)
endif()
endif()
if(TARGET layer_test)
add_dependencies(layer_test jit_download_program)
add_dependencies(layer_test_new jit_download_program)
set_tests_properties(layer_test_new PROPERTIES ENVIRONMENT
"FLAGS_jit_engine_type=New")
endif()
if(TEST buddy_allocator_test)
if(NOT WIN32)
add_dependencies(buddy_allocator_test download_data)
endif()
set_tests_properties(buddy_allocator_test PROPERTIES LABELS
"RUN_TYPE=EXCLUSIVE")
endif()
add_custom_target(build_tests)
# add target to build all cpp tests
if(${len} GREATER_EQUAL 1)
add_dependencies(build_tests ${test_names})
endif()
add_subdirectory(phi)
add_subdirectory(jit)
add_subdirectory(new_executor)
if(WITH_TESTING AND NOT WIN32)
add_custom_target(
jit_download_program
COMMAND
wget -nc -q --no-check-certificate
https://paddle-ci.gz.bcebos.com/dy2st/multi_program_load_with_property.tar.gz
COMMAND tar zxf multi_program_load_with_property.tar.gz
WORKING_DIRECTORY "${CC_TESTS_DIR}")
set(JIT_DEPS
phi
phi_api
elementwise_add_op
matmul_v2_op
activation_op
reduce_mean_op
feed_op
fetch_op
generated_op
transfer_layout_op
jit_layer)
cc_test(
layer_test
SRCS layer_test.cc
DEPS ${JIT_DEPS})
# add_dependencies(layer_test jit_download_program)
cc_test(
layer_test_new
SRCS layer_test.cc
DEPS ${JIT_DEPS})
# add_dependencies(layer_test_new jit_download_program)
# set_tests_properties(layer_test_new PROPERTIES ENVIRONMENT
# "FLAGS_jit_engine_type=New")
endif()
# skip win32 since wget is not installed by default on windows machine.
if(WITH_GPU
AND WITH_TESTING
AND NOT WIN32)
add_custom_target(
download_program
COMMAND wget -nc --no-check-certificate
https://paddle-ci.gz.bcebos.com/new_exec/lm_main_program
COMMAND wget -nc --no-check-certificate
https://paddle-ci.gz.bcebos.com/new_exec/lm_startup_program
WORKING_DIRECTORY "${CC_TESTS_DIR}")
# all operators used in the program
set(OPS
fill_constant_op
uniform_random_op
lookup_table_op
transpose_op
reshape_op
split_op
slice_op
concat_op
matmul_op
elementwise_add_op
elementwise_mul_op
softmax_with_cross_entropy_op
reduce_mean_op
reduce_sum_op
activation_op
sum_op
elementwise_max_op
elementwise_div_op
sgd_op
squared_l2_norm_op
memcpy_h2d_op
memcpy_d2h_op
fetch_v2_op)
# All deps of the operators above, part of GLOB_OPERATOR_DEPS.
set(OP_DEPS generator softmax selected_rows_functor jit_kernel_helper
concat_and_split cross_entropy)
cc_test(standalone_executor_test SRCS standalone_executor_test.cc)
# add_dependencies(standalone_executor_test download_program)
# if(WITH_PROFILER)
# target_link_libraries(standalone_executor_test profiler)
# add_dependencies(standalone_executor_test profiler)
# endif()
endif()
...@@ -27,10 +27,10 @@ TEST(PD_THROW, empty) { ...@@ -27,10 +27,10 @@ TEST(PD_THROW, empty) {
std::string err_msg = e.what(); std::string err_msg = e.what();
EXPECT_TRUE(err_msg.find("An error occurred.") != std::string::npos); EXPECT_TRUE(err_msg.find("An error occurred.") != std::string::npos);
#if _WIN32 #if _WIN32
EXPECT_TRUE(err_msg.find("tests\\api\\test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#else #else
EXPECT_TRUE(err_msg.find("paddle/phi/tests/api/test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#endif #endif
} }
...@@ -54,10 +54,10 @@ TEST(PD_THROW, non_empty) { ...@@ -54,10 +54,10 @@ TEST(PD_THROW, non_empty) {
EXPECT_TRUE(err_msg.find("PD_THROW returns 0. DataType of 1 is INT. ") != EXPECT_TRUE(err_msg.find("PD_THROW returns 0. DataType of 1 is INT. ") !=
std::string::npos); std::string::npos);
#if _WIN32 #if _WIN32
EXPECT_TRUE(err_msg.find("tests\\api\\test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#else #else
EXPECT_TRUE(err_msg.find("paddle/phi/tests/api/test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#endif #endif
} }
...@@ -84,10 +84,10 @@ TEST(PD_CHECK, FAILED) { ...@@ -84,10 +84,10 @@ TEST(PD_CHECK, FAILED) {
EXPECT_TRUE(err_msg.find("Expected false, but it's not satisfied.") != EXPECT_TRUE(err_msg.find("Expected false, but it's not satisfied.") !=
std::string::npos); std::string::npos);
#if _WIN32 #if _WIN32
EXPECT_TRUE(err_msg.find("tests\\api\\test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#else #else
EXPECT_TRUE(err_msg.find("paddle/phi/tests/api/test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#endif #endif
} }
...@@ -110,10 +110,10 @@ TEST(PD_CHECK, FAILED) { ...@@ -110,10 +110,10 @@ TEST(PD_CHECK, FAILED) {
EXPECT_TRUE(err_msg.find("PD_CHECK returns 0. DataType of 1 is INT. ") != EXPECT_TRUE(err_msg.find("PD_CHECK returns 0. DataType of 1 is INT. ") !=
std::string::npos); std::string::npos);
#if _WIN32 #if _WIN32
EXPECT_TRUE(err_msg.find("tests\\api\\test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#else #else
EXPECT_TRUE(err_msg.find("paddle/phi/tests/api/test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#endif #endif
} }
...@@ -130,10 +130,10 @@ TEST(PD_CHECK, FAILED) { ...@@ -130,10 +130,10 @@ TEST(PD_CHECK, FAILED) {
EXPECT_TRUE(err_msg.find("Expected a > b, but it's not satisfied.") != EXPECT_TRUE(err_msg.find("Expected a > b, but it's not satisfied.") !=
std::string::npos); std::string::npos);
#if _WIN32 #if _WIN32
EXPECT_TRUE(err_msg.find("tests\\api\\test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#else #else
EXPECT_TRUE(err_msg.find("paddle/phi/tests/api/test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#endif #endif
} }
...@@ -150,10 +150,10 @@ TEST(PD_CHECK, FAILED) { ...@@ -150,10 +150,10 @@ TEST(PD_CHECK, FAILED) {
EXPECT_TRUE(err_msg.find("PD_CHECK returns 0, because 123 > 0.345") != EXPECT_TRUE(err_msg.find("PD_CHECK returns 0, because 123 > 0.345") !=
std::string::npos); std::string::npos);
#if _WIN32 #if _WIN32
EXPECT_TRUE(err_msg.find("tests\\api\\test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#else #else
EXPECT_TRUE(err_msg.find("paddle/phi/tests/api/test_phi_exception.cc") != EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") !=
std::string::npos); std::string::npos);
#endif #endif
} }
......
...@@ -20,8 +20,8 @@ limitations under the License. */ ...@@ -20,8 +20,8 @@ limitations under the License. */
#include "paddle/phi/api/lib/utils/allocator.h" #include "paddle/phi/api/lib/utils/allocator.h"
#include "paddle/phi/core/dense_tensor.h" #include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/kernel_registry.h" #include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/tests/api/scale_api.h" #include "test/cpp/phi/api/scale_api.h"
#include "paddle/phi/tests/core/timer.h" #include "test/cpp/phi/core/timer.h"
PD_DECLARE_KERNEL(full, CPU, ALL_LAYOUT); PD_DECLARE_KERNEL(full, CPU, ALL_LAYOUT);
......
...@@ -15,7 +15,7 @@ limitations under the License. */ ...@@ -15,7 +15,7 @@ limitations under the License. */
#include "glog/logging.h" #include "glog/logging.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "paddle/phi/core/dense_tensor.h" #include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/tests/core/allocator.h" #include "test/cpp/phi/core/allocator.h"
namespace phi { namespace phi {
namespace tests { namespace tests {
......
...@@ -16,7 +16,7 @@ limitations under the License. */ ...@@ -16,7 +16,7 @@ limitations under the License. */
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "paddle/phi/core/dense_tensor.h" #include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/sparse_coo_tensor.h" #include "paddle/phi/core/sparse_coo_tensor.h"
#include "paddle/phi/tests/core/allocator.h" #include "test/cpp/phi/core/allocator.h"
namespace phi { namespace phi {
namespace tests { namespace tests {
......
...@@ -16,7 +16,7 @@ limitations under the License. */ ...@@ -16,7 +16,7 @@ limitations under the License. */
#include "paddle/phi/api/lib/utils/allocator.h" #include "paddle/phi/api/lib/utils/allocator.h"
#include "paddle/phi/core/dense_tensor.h" #include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/sparse_csr_tensor.h" #include "paddle/phi/core/sparse_csr_tensor.h"
#include "paddle/phi/tests/core/allocator.h" #include "test/cpp/phi/core/allocator.h"
namespace phi { namespace phi {
namespace tests { namespace tests {
......
...@@ -21,7 +21,7 @@ limitations under the License. */ ...@@ -21,7 +21,7 @@ limitations under the License. */
#include "paddle/phi/backends/context_pool.h" #include "paddle/phi/backends/context_pool.h"
#include "paddle/phi/common/pstring.h" #include "paddle/phi/common/pstring.h"
#include "paddle/phi/core/string_tensor.h" #include "paddle/phi/core/string_tensor.h"
#include "paddle/phi/tests/core/allocator.h" #include "test/cpp/phi/core/allocator.h"
namespace phi { namespace phi {
namespace tests { namespace tests {
......
...@@ -21,7 +21,7 @@ limitations under the License. */ ...@@ -21,7 +21,7 @@ limitations under the License. */
#include "paddle/phi/core/enforce.h" #include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/errors.h" #include "paddle/phi/core/errors.h"
#include "paddle/phi/core/tensor_array.h" #include "paddle/phi/core/tensor_array.h"
#include "paddle/phi/tests/core/allocator.h" #include "test/cpp/phi/core/allocator.h"
namespace phi { namespace phi {
namespace tests { namespace tests {
......
...@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "paddle/phi/tests/ops/test_op_signature.h" #include "test/cpp/phi/ops/test_op_signature.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
......
file(
GLOB TEST_OPS
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"test_*.py")
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
foreach(src ${TEST_OPS})
py_test(${src} SRCS ${src}.py)
endforeach()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册