From 882f30cd61b11d7d757e3b9aded2254cc65eed9f Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Thu, 23 Dec 2021 11:53:17 +0300 Subject: [PATCH] Added install wheel on azure for samples tests (#9179) * Added install wheel on azure for samples tests * minor change --- .ci/azure/linux.yml | 5 ++- .ci/azure/windows.yml | 7 +++- .../common/samples_common_test_clas.py | 30 ++++++-------- .../smoke_tests/requirements.txt | 1 + tools/CMakeLists.txt | 39 ------------------- 5 files changed, 22 insertions(+), 60 deletions(-) diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 383a22feb07..16b39649234 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -203,6 +203,9 @@ jobs: - script: ls -alR $(INSTALL_DIR) displayName: 'List install files' + - script: python3 -m pip install $(INSTALL_DIR)/tools/*.whl --find-links=$(INSTALL_DIR)/tools + displayName: 'Install wheels' + - script: | set -e mkdir $(INSTALL_DIR)/opencv/ @@ -324,11 +327,11 @@ jobs: continueOnError: false - script: | + export PATH=$HOME/.local/bin:$PATH export IE_APP_PATH=$(INSTALL_DIR)/samples_bin export IE_APP_PYTHON_PATH=$(INSTALL_DIR)/samples/python/ export SHARE=$(INSTALL_DIR)/tests/smoke_tests/samples_smoke_tests_data/ export WORKSPACE=$(INSTALL_DIR) - export IE_APP_PYTHON_TOOL_PATH=$(INSTALL_DIR)/tools/ . $(SETUPVARS) && python3 -m pytest $(INSTALL_DIR)/tests/smoke_tests/ --env_conf $(INSTALL_DIR)/tests/smoke_tests/env_config.yml -s --junitxml=$(BUILD_DIR)/TEST-SamplesSmokeTests.xml workingDirectory: $(INSTALL_DIR)/samples_bin displayName: 'Samples Smoke Tests' diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index 7363d058c0f..98d94cfe67e 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -109,6 +109,7 @@ jobs: python -m pip install --upgrade pip rem For running Python API tests python -m pip install -r $(REPO_DIR)\inference-engine\ie_bridges\python\src\requirements-dev.txt + python -m pip install -r $(REPO_DIR)\inference-engine\ie_bridges\python\wheel\requirements-dev.txt rem For running Paddle frontend unit tests python -m pip install -r $(REPO_DIR)\src\core\tests\frontend\paddle\requirements_dev.txt rem For running ONNX frontend unit tests @@ -132,7 +133,7 @@ jobs: - script: | set PATH=$(WORK_DIR)\ninja-win;%PATH% - call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -G "Ninja Multi-Config" -DENABLE_ONEDNN_FOR_GPU=OFF -DENABLE_INTEL_GNA=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_INTEL_GPU=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_GAPI_PREPROCESSING=$(CMAKE_BUILD_SHARED_LIBS) -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.7.6\x64\python.exe" -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.7.6\x64\include" -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.7.6\x64\libs\python37.lib" -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR) + call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -G "Ninja Multi-Config" -DENABLE_ONEDNN_FOR_GPU=OFF -DENABLE_WHEEL=ON -DENABLE_INTEL_GNA=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_INTEL_GPU=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_GAPI_PREPROCESSING=$(CMAKE_BUILD_SHARED_LIBS) -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.7.6\x64\python.exe" -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.7.6\x64\include" -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.7.6\x64\libs\python37.lib" -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR) workingDirectory: $(BUILD_DIR) displayName: 'CMake' @@ -155,6 +156,9 @@ jobs: - script: dir $(INSTALL_DIR) /s displayName: 'List install files' + - script: for %%f in ($(INSTALL_DIR)\tools\*.whl) do (python -m pip install %%f --find-links=$(INSTALL_DIR)\tools\) + displayName: 'Install Wheels' + - script: call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR)\tests\samples_tests workingDirectory: $(BUILD_SAMPLES_TESTS_DIR) displayName: 'CMake' @@ -191,7 +195,6 @@ jobs: set IE_APP_PYTHON_PATH=$(INSTALL_DIR)\samples\python\ set SHARE=$(INSTALL_DIR)\tests\smoke_tests\samples_smoke_tests_data\ set WORKSPACE=$(INSTALL_DIR) - set IE_APP_PYTHON_TOOL_PATH=$(INSTALL_DIR)\tools\ python -m pytest $(INSTALL_DIR)\tests\smoke_tests\ --env_conf $(INSTALL_DIR)\tests\smoke_tests\env_config.yml -s --junitxml=TEST-SamplesSmokeTests.xml workingDirectory: $(INSTALL_DIR) displayName: 'Samples Smoke Tests' diff --git a/tests/samples_tests/smoke_tests/common/samples_common_test_clas.py b/tests/samples_tests/smoke_tests/common/samples_common_test_clas.py index 0e4b72fbb48..0d21008f885 100644 --- a/tests/samples_tests/smoke_tests/common/samples_common_test_clas.py +++ b/tests/samples_tests/smoke_tests/common/samples_common_test_clas.py @@ -26,6 +26,7 @@ import zipfile import logging as log from common.common_utils import shell +from distutils import spawn log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=sys.stdout) @@ -142,7 +143,7 @@ def getting_samples_data_zip(url, samples_path, size_of_chunk=128): if os.path.exists(samples_path): print("\nRemoving samples_smoke_tests_data.zip...") os.remove(samples_path) - + except Exception: print(f"Exception during downloading samples_smoke_tests_data.zip") @@ -150,12 +151,8 @@ class SamplesCommonTestClass(): @classmethod def made_executable_path(cls, path1, path2, sample_type='C++'): - # This exception is made for benchmark_app, because it locates in another place. - if 'benchmark_app' in path2 and 'python' in sample_type.lower(): - executable_path = os.path.join(path1, 'benchmark_tool', path2) - else: - executable_path = os.path.join(path1, path2, path2) if 'python' in sample_type.lower() \ - else os.path.join(path1, path2) + executable_path = os.path.join(path1, path2, path2) if 'python' in sample_type.lower() \ + else os.path.join(path1, path2) is_windows = sys.platform.startswith('win') if 'python' in sample_type.lower(): executable_path += '.py' @@ -168,6 +165,9 @@ class SamplesCommonTestClass(): if is_windows and not 'python' in sample_type.lower(): executable_path += '.exe' + # This exeption is made for benchmark_app, because it locates in another place. + if 'benchmark_app' in path2 and 'python' in sample_type.lower(): + executable_path = spawn.find_executable(str('benchmark_app')) # if not hasattr(cls, 'executable_path'): cls.executable_path = executable_path @@ -360,16 +360,10 @@ class SamplesCommonTestClass(): param_cp = dict(param) sample_type = param_cp.get('sample_type', "C++") if 'python' in sample_type.lower(): - if 'benchmark_app' in self.sample_name: - assert os.environ.get('IE_APP_PYTHON_TOOL_PATH') is not None, \ - "IE_APP_PYTHON_TOOL_PATH environment variable is not specified!" - self.made_executable_path(os.environ.get('IE_APP_PYTHON_TOOL_PATH'), self.sample_name, - sample_type=sample_type) - else: - assert os.environ.get('IE_APP_PYTHON_PATH') is not None, \ - "IE_APP_PYTHON_PATH environment variable is not specified!" - self.made_executable_path(os.environ.get('IE_APP_PYTHON_PATH'), self.sample_name, - sample_type=sample_type) + assert os.environ.get('IE_APP_PYTHON_PATH') is not None, \ + "IE_APP_PYTHON_PATH environment variable is not specified!" + self.made_executable_path(os.environ.get('IE_APP_PYTHON_PATH'), self.sample_name, + sample_type=sample_type) else: self.made_executable_path(os.environ.get('IE_APP_PATH'), self.sample_name, sample_type=sample_type) @@ -462,4 +456,4 @@ class SamplesCommonTestClass(): if not is_save and os.path.exists(self.output_dir): shutil.rmtree(self.output_dir) filenames = glob.glob('out*.bmp') - [os.remove(fn) for fn in filenames] + [os.remove(fn) for fn in filenames] \ No newline at end of file diff --git a/tests/samples_tests/smoke_tests/requirements.txt b/tests/samples_tests/smoke_tests/requirements.txt index 04617a4facd..acbf75765d5 100644 --- a/tests/samples_tests/smoke_tests/requirements.txt +++ b/tests/samples_tests/smoke_tests/requirements.txt @@ -1,3 +1,4 @@ +requests pyyaml wheel test-generator diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 5d5862d4cd3..b4ae8fbc3f2 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -42,45 +42,6 @@ foreach(EXTRAS ${EXTRAS_LIST}) EXCLUDE_FROM_ALL) endforeach() -# copy benchmark_app scripts - -if(ENABLE_PYTHON) - find_package(PythonInterp 3 REQUIRED) - set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) - - if(WIN32) - set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/python_api/${PYTHON_VERSION}/openvino) - else() - set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/python_api/${PYTHON_VERSION}/openvino) - endif() - - # creates a copy inside bin directory for developers to have ability running python benchmark_app - add_custom_target(python_tools_benchmark ALL - COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/benchmark_tool/openvino/tools/benchmark - ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/benchmark - ) - - # install BA tool for tests - install(FILES benchmark_tool/README.md - benchmark_tool/requirements.txt - DESTINATION tools/benchmark_tool - COMPONENT tests - EXCLUDE_FROM_ALL) - - install(PROGRAMS benchmark_tool/benchmark_app.py - DESTINATION tools/benchmark_tool - COMPONENT tests - EXCLUDE_FROM_ALL) - - # install openvino/tools/benchmark as a python package - install(DIRECTORY benchmark_tool/openvino/tools/benchmark - DESTINATION python/${PYTHON_VERSION}/openvino/tools - USE_SOURCE_PERMISSIONS - COMPONENT tests - EXCLUDE_FROM_ALL) -endif() - add_subdirectory(mo) file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/pot/version.txt ${CI_BUILD_NUMBER})