diff --git a/python/paddle/tests/CMakeLists.txt b/python/paddle/tests/CMakeLists.txt index d50c621e1db17a8f319db08f7c280e0d3ed43b54..5c6c5f2f18a81fe5bc2067e64c450134d753e0e2 100644 --- a/python/paddle/tests/CMakeLists.txt +++ b/python/paddle/tests/CMakeLists.txt @@ -1,81 +1 @@ add_subdirectory(quantization) - -file( - GLOB TEST_OPS - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "test_*.py") -string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") - -file( - GLOB DIST_TEST_OPS - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "test_dist_*.py") -string(REPLACE ".py" "" DIST_TEST_OPS "${DIST_TEST_OPS}") - -foreach(TEST_OP ${DIST_TEST_OPS}) - list(REMOVE_ITEM TEST_OPS ${TEST_OP}) -endforeach() - -if(NOT WITH_COVERAGE) - list(REMOVE_ITEM TEST_OPS test_hapi_hub) -endif() - -foreach(src ${TEST_OPS}) - py_test(${src} SRCS ${src}.py) -endforeach() - -function(py_dist_test TARGET_NAME) - if(WITH_TESTING) - set(options "") - set(oneValueArgs "") - set(multiValueArgs SRCS DEPS ARGS ENVS) - cmake_parse_arguments(py_dist_test "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN}) - - if(WITH_COVERAGE - AND (WITH_GPU OR WITH_ROCM) - AND (WITH_NCCL OR WITH_RCCL) - AND NOT WIN32) - add_test( - NAME ${TARGET_NAME} - COMMAND - ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true - FLAGS_cudnn_deterministic=true FLAGS_cpu_deterministic=true - NCCL_P2P_DISABLE=1 NCCL_SHM_DISABLE=1 - PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_dist_test_ENVS} - COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data - ${PYTHON_EXECUTABLE} -u ${py_dist_test_SRCS} ${py_dist_test_ARGS} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - # No unit test should exceed 10 minutes. - set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 600 LABELS - "RUN_TYPE=DIST") - endif() - - endif() -endfunction() - -foreach(src ${DIST_TEST_OPS}) - message(STATUS ${src}) - py_dist_test(${src} SRCS ${src}.py) -endforeach() -set_tests_properties(test_dataset_cifar PROPERTIES TIMEOUT 120) -set_tests_properties(test_pretrained_model PROPERTIES TIMEOUT 120) -set_tests_properties(test_model PROPERTIES TIMEOUT 300) -set_tests_properties(test_dataset_movielens PROPERTIES TIMEOUT 120) -set_tests_properties(test_datasets PROPERTIES TIMEOUT 300) -set_tests_properties(test_dataset_wmt PROPERTIES TIMEOUT 120) -set_tests_properties(test_vision_models PROPERTIES TIMEOUT 120) -set_tests_properties(test_dataset_uci_housing PROPERTIES TIMEOUT 120) -set_tests_properties(test_dataset_imdb PROPERTIES TIMEOUT 300) -set_tests_properties(test_pretrained_model PROPERTIES TIMEOUT 600) -set_tests_properties(test_callback_wandb PROPERTIES TIMEOUT 60) -if(WITH_COVERAGE) - set_tests_properties(test_hapi_hub PROPERTIES TIMEOUT 300) -endif() - -if(APPLE) - set_tests_properties(test_callback_early_stop PROPERTIES TIMEOUT 300) - set_tests_properties(test_callback_reduce_lr_on_plateau PROPERTIES TIMEOUT - 300) - set_tests_properties(test_vision_models PROPERTIES TIMEOUT 300) -endif() diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index ec4cf735704565bc4a88dd291eb94c4343fd83b9..735f420ca5e9609b21cd0db2ea6577060b3d9ff3 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1,9 +1,81 @@ -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() +if(WITH_TESTING) + file( + GLOB TEST_OPS + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "test_*.py") + string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") + + file( + GLOB DIST_TEST_OPS + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "test_dist_*.py") + string(REPLACE ".py" "" DIST_TEST_OPS "${DIST_TEST_OPS}") + + foreach(TEST_OP ${DIST_TEST_OPS}) + list(REMOVE_ITEM TEST_OPS ${TEST_OP}) + endforeach() + + if(NOT WITH_COVERAGE) + list(REMOVE_ITEM TEST_OPS test_hapi_hub) + endif() + + foreach(src ${TEST_OPS}) + py_test(${src} SRCS ${src}.py) + endforeach() + + function(py_dist_test TARGET_NAME) + if(WITH_TESTING) + set(options "") + set(oneValueArgs "") + set(multiValueArgs SRCS DEPS ARGS ENVS) + cmake_parse_arguments(py_dist_test "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) + + if(WITH_COVERAGE + AND (WITH_GPU OR WITH_ROCM) + AND (WITH_NCCL OR WITH_RCCL) + AND NOT WIN32) + add_test( + NAME ${TARGET_NAME} + COMMAND + ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true + FLAGS_cudnn_deterministic=true FLAGS_cpu_deterministic=true + NCCL_P2P_DISABLE=1 NCCL_SHM_DISABLE=1 + PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_dist_test_ENVS} + COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data + ${PYTHON_EXECUTABLE} -u ${py_dist_test_SRCS} ${py_dist_test_ARGS} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + # No unit test should exceed 10 minutes. + set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 600 LABELS + "RUN_TYPE=DIST") + endif() + + endif() + endfunction() + + foreach(src ${DIST_TEST_OPS}) + message(STATUS ${src}) + py_dist_test(${src} SRCS ${src}.py) + endforeach() + set_tests_properties(test_dataset_cifar PROPERTIES TIMEOUT 120) + set_tests_properties(test_pretrained_model PROPERTIES TIMEOUT 120) + set_tests_properties(test_model PROPERTIES TIMEOUT 300) + set_tests_properties(test_dataset_movielens PROPERTIES TIMEOUT 120) + set_tests_properties(test_datasets PROPERTIES TIMEOUT 300) + set_tests_properties(test_dataset_wmt PROPERTIES TIMEOUT 120) + set_tests_properties(test_vision_models PROPERTIES TIMEOUT 120) + set_tests_properties(test_dataset_uci_housing PROPERTIES TIMEOUT 120) + set_tests_properties(test_dataset_imdb PROPERTIES TIMEOUT 300) + set_tests_properties(test_pretrained_model PROPERTIES TIMEOUT 600) + set_tests_properties(test_callback_wandb PROPERTIES TIMEOUT 60) + if(WITH_COVERAGE) + set_tests_properties(test_hapi_hub PROPERTIES TIMEOUT 300) + endif() + + if(APPLE) + set_tests_properties(test_callback_early_stop PROPERTIES TIMEOUT 300) + set_tests_properties(test_callback_reduce_lr_on_plateau PROPERTIES TIMEOUT + 300) + set_tests_properties(test_vision_models PROPERTIES TIMEOUT 300) + endif() +endif() diff --git a/python/paddle/tests/dist_hapi_mnist_dynamic.py b/test/legacy_test/dist_hapi_mnist_dynamic.py similarity index 100% rename from python/paddle/tests/dist_hapi_mnist_dynamic.py rename to test/legacy_test/dist_hapi_mnist_dynamic.py diff --git a/python/paddle/tests/dist_hapi_mnist_static.py b/test/legacy_test/dist_hapi_mnist_static.py similarity index 100% rename from python/paddle/tests/dist_hapi_mnist_static.py rename to test/legacy_test/dist_hapi_mnist_static.py diff --git a/python/paddle/tests/dist_hapi_pure_fp16_static.py b/test/legacy_test/dist_hapi_pure_fp16_static.py similarity index 100% rename from python/paddle/tests/dist_hapi_pure_fp16_static.py rename to test/legacy_test/dist_hapi_pure_fp16_static.py diff --git a/python/paddle/tests/hapi_mnist_bf16_static.py b/test/legacy_test/hapi_mnist_bf16_static.py similarity index 100% rename from python/paddle/tests/hapi_mnist_bf16_static.py rename to test/legacy_test/hapi_mnist_bf16_static.py diff --git a/python/paddle/tests/hubconf.py b/test/legacy_test/hubconf.py similarity index 100% rename from python/paddle/tests/hubconf.py rename to test/legacy_test/hubconf.py diff --git a/python/paddle/tests/test_async_read_write.py b/test/legacy_test/test_async_read_write.py similarity index 100% rename from python/paddle/tests/test_async_read_write.py rename to test/legacy_test/test_async_read_write.py diff --git a/python/paddle/tests/test_audio_backend.py b/test/legacy_test/test_audio_backend.py similarity index 100% rename from python/paddle/tests/test_audio_backend.py rename to test/legacy_test/test_audio_backend.py diff --git a/python/paddle/tests/test_audio_datasets.py b/test/legacy_test/test_audio_datasets.py similarity index 100% rename from python/paddle/tests/test_audio_datasets.py rename to test/legacy_test/test_audio_datasets.py diff --git a/python/paddle/tests/test_audio_functions.py b/test/legacy_test/test_audio_functions.py similarity index 100% rename from python/paddle/tests/test_audio_functions.py rename to test/legacy_test/test_audio_functions.py diff --git a/python/paddle/tests/test_audio_logmel_feature.py b/test/legacy_test/test_audio_logmel_feature.py similarity index 100% rename from python/paddle/tests/test_audio_logmel_feature.py rename to test/legacy_test/test_audio_logmel_feature.py diff --git a/python/paddle/tests/test_audio_mel_feature.py b/test/legacy_test/test_audio_mel_feature.py similarity index 100% rename from python/paddle/tests/test_audio_mel_feature.py rename to test/legacy_test/test_audio_mel_feature.py diff --git a/python/paddle/tests/test_callback_early_stop.py b/test/legacy_test/test_callback_early_stop.py similarity index 100% rename from python/paddle/tests/test_callback_early_stop.py rename to test/legacy_test/test_callback_early_stop.py diff --git a/python/paddle/tests/test_callback_reduce_lr_on_plateau.py b/test/legacy_test/test_callback_reduce_lr_on_plateau.py similarity index 100% rename from python/paddle/tests/test_callback_reduce_lr_on_plateau.py rename to test/legacy_test/test_callback_reduce_lr_on_plateau.py diff --git a/python/paddle/tests/test_callback_visualdl.py b/test/legacy_test/test_callback_visualdl.py similarity index 100% rename from python/paddle/tests/test_callback_visualdl.py rename to test/legacy_test/test_callback_visualdl.py diff --git a/python/paddle/tests/test_callback_wandb.py b/test/legacy_test/test_callback_wandb.py similarity index 100% rename from python/paddle/tests/test_callback_wandb.py rename to test/legacy_test/test_callback_wandb.py diff --git a/python/paddle/tests/test_callbacks.py b/test/legacy_test/test_callbacks.py similarity index 100% rename from python/paddle/tests/test_callbacks.py rename to test/legacy_test/test_callbacks.py diff --git a/python/paddle/tests/test_dataset_cifar.py b/test/legacy_test/test_dataset_cifar.py similarity index 100% rename from python/paddle/tests/test_dataset_cifar.py rename to test/legacy_test/test_dataset_cifar.py diff --git a/python/paddle/tests/test_dataset_conll05.py b/test/legacy_test/test_dataset_conll05.py similarity index 100% rename from python/paddle/tests/test_dataset_conll05.py rename to test/legacy_test/test_dataset_conll05.py diff --git a/python/paddle/tests/test_dataset_imdb.py b/test/legacy_test/test_dataset_imdb.py similarity index 100% rename from python/paddle/tests/test_dataset_imdb.py rename to test/legacy_test/test_dataset_imdb.py diff --git a/python/paddle/tests/test_dataset_imikolov.py b/test/legacy_test/test_dataset_imikolov.py similarity index 100% rename from python/paddle/tests/test_dataset_imikolov.py rename to test/legacy_test/test_dataset_imikolov.py diff --git a/python/paddle/tests/test_dataset_movielens.py b/test/legacy_test/test_dataset_movielens.py similarity index 100% rename from python/paddle/tests/test_dataset_movielens.py rename to test/legacy_test/test_dataset_movielens.py diff --git a/python/paddle/tests/test_dataset_uci_housing.py b/test/legacy_test/test_dataset_uci_housing.py similarity index 100% rename from python/paddle/tests/test_dataset_uci_housing.py rename to test/legacy_test/test_dataset_uci_housing.py diff --git a/python/paddle/tests/test_dataset_voc.py b/test/legacy_test/test_dataset_voc.py similarity index 100% rename from python/paddle/tests/test_dataset_voc.py rename to test/legacy_test/test_dataset_voc.py diff --git a/python/paddle/tests/test_dataset_wmt.py b/test/legacy_test/test_dataset_wmt.py similarity index 100% rename from python/paddle/tests/test_dataset_wmt.py rename to test/legacy_test/test_dataset_wmt.py diff --git a/python/paddle/tests/test_datasets.py b/test/legacy_test/test_datasets.py similarity index 100% rename from python/paddle/tests/test_datasets.py rename to test/legacy_test/test_datasets.py diff --git a/python/paddle/tests/test_dist_hapi_model.py b/test/legacy_test/test_dist_hapi_model.py similarity index 100% rename from python/paddle/tests/test_dist_hapi_model.py rename to test/legacy_test/test_dist_hapi_model.py diff --git a/python/paddle/tests/test_dlpack.py b/test/legacy_test/test_dlpack.py similarity index 100% rename from python/paddle/tests/test_dlpack.py rename to test/legacy_test/test_dlpack.py diff --git a/python/paddle/tests/test_download.py b/test/legacy_test/test_download.py similarity index 100% rename from python/paddle/tests/test_download.py rename to test/legacy_test/test_download.py diff --git a/python/paddle/tests/test_hapi_amp.py b/test/legacy_test/test_hapi_amp.py similarity index 100% rename from python/paddle/tests/test_hapi_amp.py rename to test/legacy_test/test_hapi_amp.py diff --git a/python/paddle/tests/test_hapi_hub.py b/test/legacy_test/test_hapi_hub.py similarity index 100% rename from python/paddle/tests/test_hapi_hub.py rename to test/legacy_test/test_hapi_hub.py diff --git a/python/paddle/tests/test_hapi_hub_model.py b/test/legacy_test/test_hapi_hub_model.py similarity index 100% rename from python/paddle/tests/test_hapi_hub_model.py rename to test/legacy_test/test_hapi_hub_model.py diff --git a/python/paddle/tests/test_logger.py b/test/legacy_test/test_logger.py similarity index 100% rename from python/paddle/tests/test_logger.py rename to test/legacy_test/test_logger.py diff --git a/python/paddle/tests/test_metrics.py b/test/legacy_test/test_metrics.py similarity index 100% rename from python/paddle/tests/test_metrics.py rename to test/legacy_test/test_metrics.py diff --git a/python/paddle/tests/test_model.py b/test/legacy_test/test_model.py similarity index 100% rename from python/paddle/tests/test_model.py rename to test/legacy_test/test_model.py diff --git a/python/paddle/tests/test_ops_roi_align.py b/test/legacy_test/test_ops_roi_align.py similarity index 100% rename from python/paddle/tests/test_ops_roi_align.py rename to test/legacy_test/test_ops_roi_align.py diff --git a/python/paddle/tests/test_ops_roi_pool.py b/test/legacy_test/test_ops_roi_pool.py similarity index 100% rename from python/paddle/tests/test_ops_roi_pool.py rename to test/legacy_test/test_ops_roi_pool.py diff --git a/python/paddle/tests/test_pretrained_model.py b/test/legacy_test/test_pretrained_model.py similarity index 100% rename from python/paddle/tests/test_pretrained_model.py rename to test/legacy_test/test_pretrained_model.py diff --git a/python/paddle/tests/test_progressbar.py b/test/legacy_test/test_progressbar.py similarity index 100% rename from python/paddle/tests/test_progressbar.py rename to test/legacy_test/test_progressbar.py diff --git a/python/paddle/tests/test_read_file.py b/test/legacy_test/test_read_file.py similarity index 100% rename from python/paddle/tests/test_read_file.py rename to test/legacy_test/test_read_file.py diff --git a/python/paddle/tests/test_transforms.py b/test/legacy_test/test_transforms.py similarity index 100% rename from python/paddle/tests/test_transforms.py rename to test/legacy_test/test_transforms.py diff --git a/python/paddle/tests/test_transforms_static.py b/test/legacy_test/test_transforms_static.py similarity index 100% rename from python/paddle/tests/test_transforms_static.py rename to test/legacy_test/test_transforms_static.py diff --git a/python/paddle/tests/test_utils_lazyimport.py b/test/legacy_test/test_utils_lazyimport.py similarity index 100% rename from python/paddle/tests/test_utils_lazyimport.py rename to test/legacy_test/test_utils_lazyimport.py diff --git a/python/paddle/tests/test_vision_models.py b/test/legacy_test/test_vision_models.py similarity index 100% rename from python/paddle/tests/test_vision_models.py rename to test/legacy_test/test_vision_models.py