diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 7ff42e47def..c3a2965ea9c 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -161,8 +161,8 @@ jobs: -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache - $(REPO_DIR) - workingDirectory: $(BUILD_DIR) + -S $(REPO_DIR) + -B $(BUILD_DIR) - script: ls -alR $(REPO_DIR)/temp/ displayName: 'List temp SDKs' @@ -185,23 +185,21 @@ jobs: - script: ls -alR $(REPO_DIR)/bin/ displayName: 'List bin files' - - script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake - workingDirectory: $(BUILD_DIR) + - script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P $(BUILD_DIR)/cmake_install.cmake displayName: 'Install' - task: CMake@1 inputs: cmakeArgs: > -GNinja - $(REPO_DIR)/tests/layer_tests - workingDirectory: $(BUILD_LAYER_TESTS_DIR) + -S $(REPO_DIR)/tests/layer_tests + -B $(BUILD_LAYER_TESTS_DIR) - script: ninja workingDirectory: $(BUILD_LAYER_TESTS_DIR) displayName: 'Build Layer Tests' - - script: cmake -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake - workingDirectory: $(BUILD_LAYER_TESTS_DIR) + - script: cmake -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P $(BUILD_LAYER_TESTS_DIR)/cmake_install.cmake displayName: 'Install Layer Tests' - script: ls -alR $(INSTALL_DIR) @@ -213,16 +211,14 @@ jobs: - script: | set -e mkdir -p $(INSTALL_DIR)/opencv/ - cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake + cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P $(BUILD_DIR)/cmake_install.cmake cp -R $(REPO_DIR)/temp/opencv_4.5.2_ubuntu20/opencv/* $(INSTALL_DIR)/opencv/ - workingDirectory: $(BUILD_DIR) displayName: 'Install tests' - script: ls -alR $(INSTALL_DIR) displayName: 'List install files' - script: $(INSTALL_DIR)/samples/cpp/build_samples.sh -i $(INSTALL_DIR) - workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build cpp samples' continueOnError: false @@ -230,12 +226,10 @@ jobs: export CC=clang export CXX=clang++ $(INSTALL_DIR)/samples/cpp/build_samples.sh -i $(INSTALL_DIR) - workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build cpp samples - clang' continueOnError: false - script: $(INSTALL_DIR)/samples/c/build_samples.sh -i $(INSTALL_DIR) - workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build c samples' continueOnError: false @@ -247,7 +241,7 @@ jobs: - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyngraph $(PYTHON_STATIC_ARGS) --junitxml=TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_backend.py + . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyngraph $(PYTHON_STATIC_ARGS) --junitxml=$(INSTALL_TEST_DIR)/TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_backend.py displayName: 'nGraph and IE Python Bindings Tests' continueOnError: false @@ -255,81 +249,81 @@ jobs: - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyopenvino $(PYTHON_STATIC_ARGS) --junitxml=TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyopenvino/tests/test_utils/test_utils.py --ignore=$(INSTALL_TEST_DIR)/pyopenvino/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyopenvino/tests/test_onnx/test_backend.py -v + export LD_LIBRARY_PATH=$(INSTALL_TEST_DIR) + . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyopenvino $(PYTHON_STATIC_ARGS) --junitxml=$(INSTALL_TEST_DIR)/TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyopenvino/tests/test_utils/test_utils.py --ignore=$(INSTALL_TEST_DIR)/pyopenvino/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyopenvino/tests/test_onnx/test_backend.py -v displayName: 'Python API 2.0 Tests' continueOnError: false - script: | export MO_ROOT=$(INSTALL_DIR)/tools/mo - . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_DIR)/tests/mo/unit_tests --junitxml=TEST-ModelOptimizer.xml + . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_DIR)/tests/mo/unit_tests --junitxml=$(INSTALL_TEST_DIR)/TEST-ModelOptimizer.xml displayName: 'Model Optimizer UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-NGraphUT.xml displayName: 'OV Core UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnx_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:TEST-ONNXImportUT.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnx_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ONNXImportUT.xml displayName: 'ONNX Frontend UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/paddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/paddle_tests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-Paddle.xml displayName: 'Paddle Frontend UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnx_frontend_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnx_frontend_tests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-Paddle.xml displayName: 'ONNX Frontend UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/tensorflow_tests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-Tensorflow.xml displayName: 'Tensorflow Frontend UT' continueOnError: false - # . $(SETUPVARS) && python3 $(WORK_DIR)/gtest-parallel/gtest_parallel.py $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --workers=16 --dump_json_test_results=InferenceEngineUnitTests.json --gtest_filter=*smoke* -- --gtest_print_time=1 - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineUnitTests.xml displayName: 'IE UT old' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ieUnitTests.xml displayName: 'IE UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-cpuUnitTests.xml displayName: 'CPU UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/gnaUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-gnaUnitTests.xml displayName: 'GNA UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-vpuUnitTests.xml displayName: 'VPU UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/XLinkTests --gtest_output=xml:TEST-XLinkTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/XLinkTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-XLinkTests.xml displayName: 'XLink Tests' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieMultiPluginUnitTests --gtest_output=xml:TEST-ieMultiPluginUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieMultiPluginUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ieMultiPluginUnitTests.xml displayName: 'MULTI UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-onnxImporterUnitTests.xml displayName: 'ONNX Importer UT' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml + - script: | + # because of IR reader v7 + export LD_LIBRARY_PATH=$(INSTALL_TEST_DIR) + . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ieFuncTests.xml displayName: 'IE FuncTests' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_template_func_tests --gtest_filter=*smoke* --gtest_output=xml:TEST-templateFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_template_func_tests --gtest_filter=*smoke* --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-templateFuncTests.xml displayName: 'TEMPLATE FuncTests' continueOnError: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-cpuFuncTests.xml displayName: 'CPU FuncTests' continueOnError: false condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'OFF') @@ -337,14 +331,14 @@ jobs: - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml + . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineCAPITests.xml displayName: 'IE CAPITests' continueOnError: false - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - . $(SETUPVARS) && $(INSTALL_TEST_DIR)/OpenVinoCAPITests --gtest_output=xml:TEST-OpenVinoCAPITests.xml + . $(SETUPVARS) && $(INSTALL_TEST_DIR)/OpenVinoCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-OpenVinoCAPITests.xml displayName: 'OV CAPITests' continueOnError: false @@ -352,16 +346,14 @@ jobs: inputs: cmakeArgs: > -GNinja - $(REPO_DIR)/tests/samples_tests - workingDirectory: $(BUILD_SAMPLES_TESTS_DIR) + -S $(REPO_DIR)/tests/samples_tests + -B $(BUILD_SAMPLES_TESTS_DIR) - - script: cmake -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake - workingDirectory: $(BUILD_SAMPLES_TESTS_DIR) + - script: cmake -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P $(BUILD_SAMPLES_TESTS_DIR)/cmake_install.cmake displayName: 'Install Samples Tests' - script: | python3 -m pip install -r $(INSTALL_DIR)/tests/smoke_tests/requirements.txt - workingDirectory: $(INSTALL_DIR) displayName: 'Install dependencies for samples smoke tests' continueOnError: false @@ -372,18 +364,16 @@ jobs: export IE_APP_PYTHON_PATH=$(INSTALL_DIR)/samples/python/ export SHARE=$(INSTALL_DIR)/tests/smoke_tests/samples_smoke_tests_data/ export WORKSPACE=$(INSTALL_DIR) - . $(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 + . $(SETUPVARS) && python3 -m pytest $(INSTALL_DIR)/tests/smoke_tests/ --env_conf $(INSTALL_DIR)/tests/smoke_tests/env_config.yml -s --junitxml=$(INSTALL_TEST_DIR)/TEST-SamplesSmokeTests.xml displayName: 'Samples Smoke Tests' continueOnError: false - script: | . $(SETUPVARS) - python3 -m pip install -r requirements.txt + python3 -m pip install -r $(LAYER_TESTS_DIR)/requirements.txt export MO_ROOT=$(INSTALL_DIR)/tools/mo export PYTHONPATH=$(LAYER_TESTS_DIR):$PYTHONPATH - python3 -m pytest tensorflow_tests/test_tf_Roll.py --ir_version=10 --junitxml=TEST-tf_Roll.xmlTEST - workingDirectory: $(LAYER_TESTS_DIR) + python3 -m pytest $(LAYER_TESTS_DIR)/tensorflow_tests/test_tf_Roll.py --ir_version=10 --junitxml=$(INSTALL_TEST_DIR)/TEST-tf_Roll.xmlTEST displayName: 'Layer Tests' continueOnError: false diff --git a/.ci/azure/mac.yml b/.ci/azure/mac.yml index d0abf2c89d3..631e0463899 100644 --- a/.ci/azure/mac.yml +++ b/.ci/azure/mac.yml @@ -101,8 +101,17 @@ jobs: export PATH="/usr/local/opt/cython/bin:$PATH" export CC=gcc export CXX=g++ - cmake -GNinja -DVERBOSE_BUILD=ON -DENABLE_REQUIREMENTS_INSTALL=OFF -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_PYTHON=ON -DENABLE_TESTS=OFF -DENABLE_STRICT_DEPENDENCIES=OFF -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache $(REPO_DIR) - workingDirectory: $(BUILD_DIR) + cmake -GNinja -DVERBOSE_BUILD=ON \ + -DENABLE_REQUIREMENTS_INSTALL=OFF \ + -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \ + -DENABLE_PYTHON=ON \ + -DENABLE_TESTS=OFF \ + -DENABLE_STRICT_DEPENDENCIES=OFF \ + -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -S $(REPO_DIR) \ + -B $(BUILD_DIR) displayName: 'CMake' - script: ls -alR $(REPO_DIR)/temp/ @@ -134,8 +143,7 @@ jobs: - script: ls -alR $(REPO_DIR)/bin/ displayName: 'List bin files' - - script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake - workingDirectory: $(BUILD_DIR) + - script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P $(BUILD_DIR)/cmake_install.cmake displayName: 'Install' - script: ls -alR $(INSTALL_DIR) @@ -144,62 +152,59 @@ jobs: - script: | set -e mkdir -p $(INSTALL_DIR)/opencv/ - cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake + cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P $(BUILD_DIR)/cmake_install.cmake cp -R $(REPO_DIR)/temp/opencv_4.5.2_osx/opencv/* $(INSTALL_DIR)/opencv/ - workingDirectory: $(BUILD_DIR) displayName: 'Install tests' - script: ls -alR $(INSTALL_DIR) displayName: 'List install files' - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-NGraphUT.xml displayName: 'OV Core UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnx_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU*:IE_CPU.onnx_model_sigmoid:IE_CPU/GRUSequenceOp.onnx_model_gru* --gtest_output=xml:TEST-ONNXImportUT.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnx_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU*--gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ONNXImportUT.xml displayName: 'ONNX Frontend UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_filter=-MKLDNNGraphStructureTests.TestNoRedundantReordersBeforeDWConvolution:TestConvolution/MKLDNNGraphConvolutionTests.TestsConvolution/0:TestConvolutionDefaultPrimitivesPriority/MKLDNNGraphConvolutionTests.TestsConvolution/0 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineUnitTests.xml displayName: 'IE UT old' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ieUnitTests.xml displayName: 'IE UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-cpuUnitTests.xml displayName: 'CPU UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-vpuUnitTests.xml displayName: 'VPU UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-onnxImporterUnitTests.xml displayName: 'ONNX Importer UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieMultiPluginUnitTests --gtest_output=xml:TEST-ieMultiPluginUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieMultiPluginUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ieMultiPluginUnitTests.xml displayName: 'MULTI UT' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ieFuncTests.xml displayName: 'IE FuncTests' continueOnError: false enabled: false - - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke*:-smoke_LPT/ReduceMinTransformation.CompareWithRefImpl/f32_Shape* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-cpuFuncTests.xml displayName: 'CPU FuncTests' continueOnError: false enabled: false @@ -207,7 +212,7 @@ jobs: - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml + . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineCAPITests.xml displayName: 'IE CAPITests' continueOnError: false enabled: false @@ -215,7 +220,7 @@ jobs: - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - . $(SETUPVARS) && $(INSTALL_TEST_DIR)/OpenVinoCAPITests --gtest_output=xml:TEST-OpenVinoCAPITests.xml + . $(SETUPVARS) && $(INSTALL_TEST_DIR)/OpenVinoCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-OpenVinoCAPITests.xml displayName: 'IE CAPITests' continueOnError: false enabled: false diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index add157cb977..8d49a179725 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -32,7 +32,7 @@ jobs: maxParallel: 2 # About 150% of total time - timeoutInMinutes: 270 #Temporary change + timeoutInMinutes: 270 #Temporary change pool: name: WIN_VMSS_VENV_D8S_WU2 @@ -144,15 +144,13 @@ jobs: - script: | set PATH=$(WORK_DIR)\ninja-win;%PATH% - call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="$(CMAKE_CMD) --build . --config Release" - workingDirectory: $(BUILD_DIR) + call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="$(CMAKE_CMD) --build $(BUILD_DIR) --config Release" displayName: 'Build Win - IB' - script: dir $(REPO_DIR)\bin\ /s displayName: 'List bin files' - - script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake - workingDirectory: $(BUILD_DIR) + - script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P $(BUILD_DIR)/cmake_install.cmake displayName: 'Install' - script: dir $(INSTALL_DIR) /s @@ -165,23 +163,18 @@ jobs: workingDirectory: $(BUILD_SAMPLES_TESTS_DIR) displayName: 'CMake' - - script: $(CMAKE_CMD) -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake - workingDirectory: $(BUILD_SAMPLES_TESTS_DIR) + - script: $(CMAKE_CMD) -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P $(BUILD_SAMPLES_TESTS_DIR)\cmake_install.cmake displayName: 'Install Samples Tests' - script: $(INSTALL_DIR)\samples\cpp\build_samples_msvc.bat -i $(INSTALL_DIR) - workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build cpp samples' continueOnError: false - script: $(INSTALL_DIR)\samples\c\build_samples_msvc.bat -i $(INSTALL_DIR) - workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build c samples' continueOnError: false - - script: | - python -m pip install -r $(INSTALL_DIR)\tests\smoke_tests\requirements.txt - workingDirectory: $(INSTALL_DIR) + - script: python -m pip install -r $(INSTALL_TEST_DIR)\smoke_tests\requirements.txt displayName: 'Install dependencies for samples smoke tests' continueOnError: false @@ -190,13 +183,13 @@ 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) - 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) + python -m pytest $(INSTALL_DIR)\tests\smoke_tests\ --env_conf $(INSTALL_TEST_DIR)\smoke_tests\env_config.yml -s --junitxml=$(INSTALL_TEST_DIR)/TEST-SamplesSmokeTests.xml displayName: 'Samples Smoke Tests' continueOnError: false - - script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake && xcopy $(REPO_DIR)\temp\opencv_4.5.2\opencv\* $(INSTALL_DIR)\opencv\ /e /h /y - workingDirectory: $(BUILD_DIR) + - script: | + $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P $(BUILD_DIR)\cmake_install.cmake && \ + xcopy $(REPO_DIR)\temp\opencv_4.5.2\opencv\* $(INSTALL_DIR)\opencv\ /e /h /y displayName: 'Install tests' - script: dir $(INSTALL_DIR) /s @@ -206,74 +199,71 @@ jobs: displayName: 'Clean build dir' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-NGraphUT.xml displayName: 'OV Core UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnx_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:TEST-ONNXImportUT.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnx_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ONNXImportUT.xml displayName: 'ONNX Frontend UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddle_tests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-Paddle.xml displayName: 'Paddle Frontend UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnx_frontend_tests --gtest_print_time=1 --gtest_output=xml:TEST-ONNX.xml - workingDirectory: $(INSTALL_TEST_DIR) + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnx_frontend_tests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ONNX.xml displayName: 'ONNX Frontend UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-Tensorflow.xml displayName: 'Tensorflow Frontend UT' continueOnError: false # set PATH=$(IB_DIR);%PATH% - # call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\InferenceEngineUnitTests.exe --gtest_output=xml:TEST-InferenceEngineUnitTests-IB.xml - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineUnitTests --gtest_output=xml:TEST-InferenceEngineUnitTests.xml + # call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\InferenceEngineUnitTests.exe --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-InferenceEngineUnitTests-IB.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-InferenceEngineUnitTests.xml displayName: 'IE UT old' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ieUnitTests.xml displayName: 'IE UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-cpuUnitTests.xml displayName: 'CPU UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\gnaUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-gnaUnitTests.xml displayName: 'GNA UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\vpuUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-vpuUnitTests.xml displayName: 'VPU UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\XLinkTests --gtest_output=xml:TEST-XLinkTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\XLinkTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-XLinkTests.xml displayName: 'XLink Tests' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnxImporterUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-onnxImporterUnitTests.xml displayName: 'ONNX Importer UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieMultiPluginUnitTests --gtest_output=xml:TEST-ieMultiPluginUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieMultiPluginUnitTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ieMultiPluginUnitTests.xml displayName: 'MULTI UT' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieFuncTests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ieFuncTests.xml displayName: 'IE FuncTests' continueOnError: false - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_template_func_tests --gtest_output=xml:TEST-templateFuncTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_template_func_tests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-templateFuncTests.xml displayName: 'TEMPLATE FuncTests' continueOnError: false # set PATH=$(IB_DIR);%PATH% - # call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\cpuFuncTests.exe --gtest_filter=*smoke*:-*CompareWithRefs/base_size=16_pre_nms_topn=100_post_nms_topn=100_nms_thresh=0.7_feat_stride=1_min_size=1_ratio*:*smoke_GRUSequenceCommonZeroClip/GRUSequenceTest.CompareWithRefs/mode=CONVERT_TO_TI_MAX_SEQ_LEN_CONST_seq_lengths* --gtest_output=xml:TEST-cpuFuncTests-IB.xml /testlevel=24 - - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuFuncTests --gtest_filter=*smoke* --gtest_output=xml:TEST-cpuFuncTests.xml + # call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\cpuFuncTests.exe --gtest_filter=*smoke*:-*CompareWithRefs/base_size=16_pre_nms_topn=100_post_nms_topn=100_nms_thresh=0.7_feat_stride=1_min_size=1_ratio*:*smoke_GRUSequenceCommonZeroClip/GRUSequenceTest.CompareWithRefs/mode=CONVERT_TO_TI_MAX_SEQ_LEN_CONST_seq_lengths* --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-cpuFuncTests-IB.xml /testlevel=24 + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuFuncTests --gtest_filter=*smoke* --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-cpuFuncTests.xml displayName: 'CPU FuncTests' continueOnError: false condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'OFF') @@ -281,14 +271,14 @@ jobs: - script: | set DATA_PATH=$(MODELS_PATH) set MODELS_PATH=$(MODELS_PATH) - call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml + call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-InferenceEngineCAPITests.xml displayName: 'IE CAPITests' continueOnError: false - script: | set DATA_PATH=$(MODELS_PATH) set MODELS_PATH=$(MODELS_PATH) - call $(SETUPVARS) && $(INSTALL_TEST_DIR)\OpenVinoCAPITests --gtest_output=xml:TEST-OpenVinoCAPITests.xml + call $(SETUPVARS) && $(INSTALL_TEST_DIR)\OpenVinoCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-OpenVinoCAPITests.xml displayName: 'OV CAPITests' continueOnError: false diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index dfa2a5de3d0..aecec434fe5 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -36,6 +36,8 @@ RUN apt-get update && apt-get -y --no-install-recommends install \ ocl-icd-opencl-dev \ pkg-config \ unzip \ + libtbb-dev \ + libpugixml-dev \ wget \ # Python dependencies python3 \ @@ -80,5 +82,5 @@ RUN ninja install WORKDIR /openvino/src/bindings/python ENV OpenVINO_DIR=/openvino/dist/runtime/cmake ENV LD_LIBRARY_PATH=/openvino/dist/runtime/lib:/openvino/dist/runtime/3rdparty/tbb/lib -ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} +ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/python_api/python3.8:${PYTHONPATH} CMD tox diff --git a/CMakeLists.txt b/CMakeLists.txt index 41547ab5d00..7de988ce732 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,12 @@ if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS) # incorrect OpenVINOConfig.cmake in this case cmake_minimum_required(VERSION 3.17) else() - cmake_minimum_required(VERSION 3.13) + if(CPACK_GENERATOR STREQUAL "DEB") + # we have to use CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS variable + cmake_minimum_required(VERSION 3.20) + else() + cmake_minimum_required(VERSION 3.13) + endif() endif() project(OpenVINO DESCRIPTION "OpenVINO toolkit") diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake index f187fe35780..da5278c2b37 100644 --- a/cmake/developer_package/IEDevScriptsConfig.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -14,7 +14,7 @@ set(CMAKE_MODULE_PATH "${IEDevScripts_DIR}") function(set_ci_build_number) set(repo_root "${CMAKE_SOURCE_DIR}") include(version) - foreach(var CI_BUILD_NUMBER OpenVINO_VERSION OpenVINO_VERSION_BUILD + foreach(var CI_BUILD_NUMBER OpenVINO_VERSION OpenVINO_SOVERSION OpenVINO_VERSION_SUFFIX OpenVINO_VERSION_BUILD OpenVINO_VERSION_MAJOR OpenVINO_VERSION_MINOR OpenVINO_VERSION_PATCH) if(NOT DEFINED ${var}) message(FATAL_ERROR "${var} version component is not defined") @@ -87,7 +87,6 @@ endif() # Common scripts # -include(packaging/packaging) include(coverage/coverage) include(shellcheck/shellcheck) @@ -164,13 +163,8 @@ macro(ov_set_if_not_defined var value) endif() endmacro() -if(NOT UNIX) - ov_set_if_not_defined(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) - ov_set_if_not_defined(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) -else() - ov_set_if_not_defined(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/lib) - ov_set_if_not_defined(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/lib) -endif() +ov_set_if_not_defined(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) +ov_set_if_not_defined(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) ov_set_if_not_defined(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) ov_set_if_not_defined(CMAKE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) ov_set_if_not_defined(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}) @@ -195,6 +189,8 @@ set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "Don't warn about obsolete cmake versio set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON CACHE BOOL "Warn about absolute paths in destination") set(CMAKE_SKIP_INSTALL_RPATH ON) +include(packaging/packaging) + # LTO if(ENABLE_LTO) diff --git a/cmake/developer_package/frontends/frontends.cmake b/cmake/developer_package/frontends/frontends.cmake index 6e123ca2f88..e920cc1cd67 100644 --- a/cmake/developer_package/frontends/frontends.cmake +++ b/cmake/developer_package/frontends/frontends.cmake @@ -196,13 +196,7 @@ macro(ov_add_frontend) target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime) target_link_libraries(${TARGET_NAME} PRIVATE ${OV_FRONTEND_LINK_LIBRARIES}) - - # TODO: define proper library version, currently SOVERSION 2022 - if(CPACK_GENERATOR STREQUAL "DEB") - set_target_properties(${TARGET_NAME} PROPERTIES - SOVERSION ${OpenVINO_VERSION_MAJOR} - VERSION ${OpenVINO_VERSION}) - endif() + ov_add_library_version(${TARGET_NAME}) # WA for TF frontends which always require protobuf (not protobuf-lite) # if TF FE is built in static mode, use protobuf for all other FEs diff --git a/cmake/developer_package/packaging/changelog b/cmake/developer_package/packaging/changelog index cf01c3b7a6d..bfa4894e109 100644 --- a/cmake/developer_package/packaging/changelog +++ b/cmake/developer_package/packaging/changelog @@ -1,6 +1,5 @@ openvino (2022.2.0) unstable; urgency=low - [Ilya Lavrenov] * Implemented Debian packages support * Support of Ubuntu 22.04 * Support of python 3.10 @@ -10,7 +9,6 @@ openvino (2022.2.0) unstable; urgency=low openvino (2022.1.0) unstable; urgency=low - [Ilya Lavrenov] * Implemented OpenVINO 2.0 Runtime API for both C++ and Python * Introduced IR v11 which is aligned with frameworks model format diff --git a/cmake/developer_package/packaging/debian.cmake b/cmake/developer_package/packaging/debian.cmake index face58206bf..40a3dbeeb0e 100644 --- a/cmake/developer_package/packaging/debian.cmake +++ b/cmake/developer_package/packaging/debian.cmake @@ -16,17 +16,18 @@ macro(ov_debian_cpack_set_dirs) set(OV_CPACK_LIBRARYDIR ${CMAKE_INSTALL_LIBDIR}) set(OV_CPACK_RUNTIMEDIR ${CMAKE_INSTALL_LIBDIR}) set(OV_CPACK_ARCHIVEDIR ${CMAKE_INSTALL_LIBDIR}) - set(OV_CPACK_PLUGINSDIR ${CMAKE_INSTALL_LIBDIR}/openvino${OpenVINO_VERSION}) + set(OV_CPACK_PLUGINSDIR ${CMAKE_INSTALL_LIBDIR}/openvino-${OpenVINO_VERSION}) set(OV_CPACK_IE_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/inferenceengine${OpenVINO_VERSION}) set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION}) set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION}) - set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino${OpenVINO_VERSION}) + set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION}) # non-native stuff set(OV_CPACK_PYTHONDIR ${OV_CPACK_PLUGINSDIR}) - set(OV_CPACK_SHAREDIR ${CMAKE_INSTALL_DATADIR}/openvino${OpenVINO_VERSION}) # internal + set(OV_CPACK_SHAREDIR ${CMAKE_INSTALL_DATADIR}/openvino-${OpenVINO_VERSION}) # internal set(OV_CPACK_SAMPLESDIR ${OV_CPACK_SHAREDIR}/samples) set(OV_CPACK_DEVREQDIR ${OV_CPACK_SHAREDIR}) + unset(OV_CPACK_SHAREDIR) set(OV_CPACK_WHEELSDIR .) # TODO @@ -88,12 +89,17 @@ macro(ov_debian_specific_settings) # WA: dpkg-shlibdeps requires folder with libraries # proper way is to use -l (path to libs) and -L (path to shlibs) for other already installed components - # but it require CMake source code changes + # but it requires CMake source code changes # with current WA automatic deps detection via dpkg-shlibdeps for "our libraries" # is ignored; but dependencies between our components are here because of # CPACK_COMPONENT__DEPENDS variables # More proper WA is try to enable INSTALL_RPATH - set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + + if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + else() + message(FATAL_ERROR "CMAKE_LIBRARY_OUTPUT_DIRECTORY is empty") + endif() # automatic dependencies discovering between openvino and user packages set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) @@ -103,6 +109,8 @@ macro(ov_debian_specific_settings) set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") # need to update this version once we rebuild the same package with additional fixes # set(CPACK_DEBIAN_PACKAGE_RELEASE "1") + # enable this if someday we change the version scheme + # set(CPACK_DEBIAN_PACKAGE_EPOCH "2") endmacro() ov_debian_specific_settings() @@ -208,25 +216,25 @@ endfunction() # ov_debian_generate_conflicts() # function(ov_debian_generate_conflicts comp) - set(versions ${ARGN}) + set(cpack_name_versions ${ARGN}) string(TOUPPER "${comp}" ucomp) # sanity check if(NOT DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) message(FATAL_ERROR "CPACK_DEBIAN_${ucomp}_PACKAGE_NAME is not defined") else() - if(NOT DEFINED CPACK_PACKAGE_VERSION) - message(FATAL_ERROR "CPACK_PACKAGE_VERSION is not defined") + if(NOT DEFINED cpack_name_ver) + message(FATAL_ERROR "Internal variable 'cpack_name_ver' is not defined") endif() - string(REPLACE "${CPACK_PACKAGE_VERSION}" "" package_name_base "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") + string(REPLACE "${cpack_name_ver}" "" package_name_base "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") endif() - foreach(version IN LISTS versions) + foreach(cpack_name_version IN LISTS cpack_name_versions) if(package_names) - set(package_names "${package_names}, ${package_name_base}${version}") + set(package_names "${package_names}, ${package_name_base}${cpack_name_version}") else() - set(package_names "${package_name_base}${version}") + set(package_names "${package_name_base}${cpack_name_version}") endif() endforeach() @@ -250,7 +258,7 @@ macro(ov_debian_add_latest_component comp) # take package name if(DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) - string(REPLACE "-${cpack_ver_mm}" "" + string(REPLACE "-${cpack_name_ver}" "" CPACK_DEBIAN_${upper_case}_PACKAGE_NAME "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") else() diff --git a/cmake/developer_package/packaging/packaging.cmake b/cmake/developer_package/packaging/packaging.cmake index 39265f9f73e..25ec4661e1e 100644 --- a/cmake/developer_package/packaging/packaging.cmake +++ b/cmake/developer_package/packaging/packaging.cmake @@ -158,6 +158,10 @@ macro(ie_cpack) endif() set(CPACK_PACKAGE_VERSION "${OpenVINO_VERSION}") + if(NOT OpenVINO_VERSION_BUILD STREQUAL "000") + set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${OpenVINO_VERSION_BUILD}") + endif() + foreach(ver MAJOR MINOR PATCH) if(DEFINED OpenVINO_VERSION_${ver}) set(CPACK_PACKAGE_VERSION_${ver} ${OpenVINO_VERSION_${ver}}) diff --git a/cmake/developer_package/version.cmake b/cmake/developer_package/version.cmake index 8567fde76ad..0f048321d3d 100644 --- a/cmake/developer_package/version.cmake +++ b/cmake/developer_package/version.cmake @@ -93,7 +93,14 @@ macro(ov_parse_ci_build_number) endforeach() endif() + set(OpenVINO_SOVERSION "${OpenVINO_VERSION_MAJOR}${OpenVINO_VERSION_MINOR}${OpenVINO_VERSION_PATCH}") set(OpenVINO_VERSION "${OpenVINO_VERSION_MAJOR}.${OpenVINO_VERSION_MINOR}.${OpenVINO_VERSION_PATCH}") + # TODO: remove DEB later + if(WIN32 OR NOT CPACK_GENERATOR STREQUAL "DEB") + set(OpenVINO_VERSION_SUFFIX "") + else() + set(OpenVINO_VERSION_SUFFIX ".${OpenVINO_VERSION}") + endif() message(STATUS "OpenVINO version is ${OpenVINO_VERSION} (Build ${OpenVINO_VERSION_BUILD})") endmacro() @@ -131,3 +138,15 @@ macro (addVersionDefines FILE) endforeach() unset(__version_file) endmacro() + +function(ov_add_library_version library) + if(CPACK_GENERATOR STREQUAL "DEB") + if(NOT DEFINED OpenVINO_SOVERSION) + message(FATAL_ERROR "Internal error: OpenVINO_SOVERSION is not defined") + endif() + + set_target_properties(${library} PROPERTIES + SOVERSION ${OpenVINO_SOVERSION} + VERSION ${OpenVINO_VERSION}) + endif() +endfunction() diff --git a/cmake/features.cmake b/cmake/features.cmake index 698d4440f0d..08dd4c0bce4 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -126,7 +126,7 @@ ie_dependent_option (ENABLE_FUNCTIONAL_TESTS "functional tests" ON "ENABLE_TESTS ie_dependent_option (ENABLE_SAMPLES "console samples are part of inference engine package" ON "NOT MINGW" OFF) -ie_option (ENABLE_OPENCV "enables OpenCV" ON) +ie_option (ENABLE_OPENCV "enables custom OpenCV download" ON) ie_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF) diff --git a/cmake/packaging/debian.cmake b/cmake/packaging/debian.cmake index 78af23c9885..16c10985a70 100644 --- a/cmake/packaging/debian.cmake +++ b/cmake/packaging/debian.cmake @@ -14,18 +14,22 @@ function(_ov_add_plugin comp is_pseudo) set(package_name "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") endif() + if(NOT DEFINED cpack_full_ver) + message(FATAL_ERROR "Internal variable 'cpack_full_ver' is not defined") + endif() + if(is_pseudo) if(pseudo_plugins_recommends) - set(pseudo_plugins_recommends "${pseudo_plugins_recommends}, ${package_name} (= ${CPACK_PACKAGE_VERSION})") + set(pseudo_plugins_recommends "${pseudo_plugins_recommends}, ${package_name} (= ${cpack_full_ver})") else() - set(pseudo_plugins_recommends "${package_name} (= ${CPACK_PACKAGE_VERSION})") + set(pseudo_plugins_recommends "${package_name} (= ${cpack_full_ver})") endif() endif() if(all_plugins_suggest) - set(all_plugins_suggest "${all_plugins_suggest}, ${package_name} (= ${CPACK_PACKAGE_VERSION})") + set(all_plugins_suggest "${all_plugins_suggest}, ${package_name} (= ${cpack_full_ver})") else() - set(all_plugins_suggest "${package_name} (= ${CPACK_PACKAGE_VERSION})") + set(all_plugins_suggest "${package_name} (= ${cpack_full_ver})") endif() list(APPEND installed_plugins ${comp}) @@ -47,6 +51,8 @@ macro(ov_cpack_settings) # even for case of system TBB we have installation rules for wheels packages # so, need to skip this explicitly NOT item MATCHES "^tbb(_dev)?$" AND + # we have copyright file for debian package + NOT item STREQUAL OV_CPACK_COMP_LICENSING AND # not appropriate components NOT item STREQUAL OV_CPACK_COMP_DEPLOYMENT_MANAGER AND NOT item STREQUAL OV_CPACK_COMP_INSTALL_DEPENDENCIES AND @@ -57,15 +63,30 @@ macro(ov_cpack_settings) list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL) # version with 3 components - set(cpack_ver_mm "${CPACK_PACKAGE_VERSION}") + set(cpack_name_ver "${OpenVINO_VERSION}") + # full version with epoch and release components + set(cpack_full_ver "${CPACK_PACKAGE_VERSION}") + + # take release version into account + if(DEFINED CPACK_DEBIAN_PACKAGE_RELEASE) + set(cpack_full_ver "${cpack_full_ver}-${CPACK_DEBIAN_PACKAGE_RELEASE}") + endif() + + # take epoch version into account + if(DEFINED CPACK_DEBIAN_PACKAGE_EPOCH) + set(cpack_full_ver "${CPACK_DEBIAN_PACKAGE_EPOCH}:${cpack_full_ver}") + endif() + # a list of conflicting package versions set(conflicting_versions # 2022 release series + # - 2022.1.0 is the last public release with debian packages from Intel install team + # - 2022.1.1 does not have debian packages enabled, distributed only as archives 2022.1.0) # core set(CPACK_COMPONENT_CORE_DESCRIPTION "OpenVINO C / C++ Runtime libraries") - set(CPACK_DEBIAN_CORE_PACKAGE_NAME "libopenvino-${cpack_ver_mm}") + set(CPACK_DEBIAN_CORE_PACKAGE_NAME "libopenvino-${cpack_name_ver}") # we need triggers to run ldconfig for openvino set(CPACK_DEBIAN_CORE_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") @@ -77,7 +98,7 @@ macro(ov_cpack_settings) # core_dev set(CPACK_COMPONENT_CORE_DEV_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit C / C++ Development files") set(CPACK_COMPONENT_CORE_DEV_DEPENDS "core") - set(CPACK_DEBIAN_CORE_DEV_PACKAGE_NAME "libopenvino-dev-${cpack_ver_mm}") + set(CPACK_DEBIAN_CORE_DEV_PACKAGE_NAME "libopenvino-dev-${cpack_name_ver}") ov_debian_generate_conflicts(core_dev ${conflicting_versions}) ov_debian_add_lintian_suppression(core_dev @@ -92,7 +113,7 @@ macro(ov_cpack_settings) if(ENABLE_HETERO) set(CPACK_COMPONENT_HETERO_DESCRIPTION "OpenVINO Hetero plugin") set(CPACK_COMPONENT_HETERO_DEPENDS "core") - set(CPACK_DEBIAN_HETERO_PACKAGE_NAME "libopenvino-hetero-${cpack_ver_mm}") + set(CPACK_DEBIAN_HETERO_PACKAGE_NAME "libopenvino-hetero-${cpack_name_ver}") set(CPACK_DEBIAN_HETERO_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") _ov_add_plugin(hetero ON) endif() @@ -101,7 +122,7 @@ macro(ov_cpack_settings) if(ENABLE_AUTO_BATCH) set(CPACK_COMPONENT_BATCH_DESCRIPTION "OpenVINO Automatic Batching plugin") set(CPACK_COMPONENT_BATCH_DEPENDS "core") - set(CPACK_DEBIAN_BATCH_PACKAGE_NAME "libopenvino-auto-batch-${cpack_ver_mm}") + set(CPACK_DEBIAN_BATCH_PACKAGE_NAME "libopenvino-auto-batch-${cpack_name_ver}") set(CPACK_DEBIAN_BATCH_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") _ov_add_plugin(batch ON) endif() @@ -114,13 +135,13 @@ macro(ov_cpack_settings) set(CPACK_COMPONENT_MULTI_DESCRIPTION "OpenVINO Multi plugin") endif() set(CPACK_COMPONENT_MULTI_DEPENDS "core") - set(CPACK_DEBIAN_MULTI_PACKAGE_NAME "libopenvino-auto-${cpack_ver_mm}") + set(CPACK_DEBIAN_MULTI_PACKAGE_NAME "libopenvino-auto-${cpack_name_ver}") set(CPACK_DEBIAN_MULTI_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") _ov_add_plugin(multi ON) elseif(ENABLE_AUTO) set(CPACK_COMPONENT_AUTO_DESCRIPTION "OpenVINO Auto plugin") set(CPACK_COMPONENT_AUTO_DEPENDS "core") - set(CPACK_DEBIAN_AUTO_PACKAGE_NAME "libopenvino-auto-${cpack_ver_mm}") + set(CPACK_DEBIAN_AUTO_PACKAGE_NAME "libopenvino-auto-${cpack_name_ver}") set(CPACK_DEBIAN_AUTO_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") _ov_add_plugin(auto ON) endif() @@ -129,7 +150,7 @@ macro(ov_cpack_settings) if(ENABLE_INTEL_CPU) set(CPACK_COMPONENT_CPU_DESCRIPTION "Intel® CPU") set(CPACK_COMPONENT_CPU_DEPENDS "core") - set(CPACK_DEBIAN_CPU_PACKAGE_NAME "libopenvino-intel-cpu-${cpack_ver_mm}") + set(CPACK_DEBIAN_CPU_PACKAGE_NAME "libopenvino-intel-cpu-${cpack_name_ver}") set(CPACK_DEBIAN_CPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") _ov_add_plugin(cpu OFF) endif() @@ -138,8 +159,10 @@ macro(ov_cpack_settings) if(ENABLE_INTEL_GPU) set(CPACK_COMPONENT_GPU_DESCRIPTION "Intel® Processor Graphics") set(CPACK_COMPONENT_GPU_DEPENDS "core") - set(CPACK_DEBIAN_GPU_PACKAGE_NAME "libopenvino-intel-gpu-${cpack_ver_mm}") + set(CPACK_DEBIAN_GPU_PACKAGE_NAME "libopenvino-intel-gpu-${cpack_name_ver}") set(CPACK_DEBIAN_GPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + # auto batch exhances GPU + # set(CPACK_DEBIAN_BATCH_PACKAGE_ENHANCES "${CPACK_DEBIAN_GPU_PACKAGE_NAME} = (${cpack_full_ver})") _ov_add_plugin(gpu OFF) endif() @@ -147,7 +170,7 @@ macro(ov_cpack_settings) if(ENABLE_INTEL_MYRIAD) set(CPACK_COMPONENT_MYRIAD_DESCRIPTION "Intel® Movidius™ VPU") set(CPACK_COMPONENT_MYRIAD_DEPENDS "core") - set(CPACK_DEBIAN_MYRIAD_PACKAGE_NAME "libopenvino-intel-vpu-${cpack_ver_mm}") + set(CPACK_DEBIAN_MYRIAD_PACKAGE_NAME "libopenvino-intel-vpu-${cpack_name_ver}") set(CPACK_DEBIAN_MYRIAD_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") _ov_add_plugin(myriad OFF) endif() @@ -156,7 +179,7 @@ macro(ov_cpack_settings) if(ENABLE_INTEL_GNA) set(CPACK_COMPONENT_GNA_DESCRIPTION "Intel® Gaussian Neural Accelerator") set(CPACK_COMPONENT_GNA_DEPENDS "core") - set(CPACK_DEBIAN_GNA_PACKAGE_NAME "libopenvino-intel-gna-${cpack_ver_mm}") + set(CPACK_DEBIAN_GNA_PACKAGE_NAME "libopenvino-intel-gna-${cpack_name_ver}") # since we have libgna.so we need to call ldconfig and have `def_triggers` here set(CPACK_DEBIAN_GNA_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") @@ -186,7 +209,7 @@ macro(ov_cpack_settings) else() set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DEPENDS "core") endif() - set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_NAME "libopenvino-python-${cpack_ver_mm}") + set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_NAME "libopenvino-python-${cpack_name_ver}") set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") endif() @@ -200,7 +223,7 @@ macro(ov_cpack_settings) # c_samples / cpp_samples set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit C / C++ Samples") set(CPACK_COMPONENT_SAMPLES_DEPENDS "core_dev") - set(CPACK_DEBIAN_SAMPLES_PACKAGE_NAME "openvino-samples-${cpack_ver_mm}") + set(CPACK_DEBIAN_SAMPLES_PACKAGE_NAME "openvino-samples-${cpack_name_ver}") set(CPACK_DEBIAN_SAMPLES_PACKAGE_SUGGESTS "${samples_build_deps_suggest}, ${all_plugins_suggest}") set(CPACK_DEBIAN_SAMPLES_PACKAGE_DEPENDS "libgflags-dev, nlohmann-json3-dev, zlib1g-dev") # can be skipped with --no-install-recommends @@ -209,7 +232,7 @@ macro(ov_cpack_settings) # python_samples set(CPACK_COMPONENT_PYTHON_SAMPLES_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Python Samples") - set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_NAME "openvino-samples-python-${cpack_ver_mm}") + set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_NAME "openvino-samples-python-${cpack_name_ver}") set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_DEPENDS "python3") set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_ARCHITECTURE "all") @@ -224,7 +247,7 @@ macro(ov_cpack_settings) else() set(CPACK_COMPONENT_LIBRARIES_DEPENDS "core") endif() - set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "openvino-libraries-${cpack_ver_mm}") + set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "openvino-libraries-${cpack_name_ver}") ov_debian_add_lintian_suppression(libraries # it's umbrella package @@ -233,7 +256,7 @@ macro(ov_cpack_settings) # all libraries-dev set(CPACK_COMPONENT_LIBRARIES_DEV_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Libraries and Development files") set(CPACK_COMPONENT_LIBRARIES_DEV_DEPENDS "core_dev;libraries") - set(CPACK_DEBIAN_LIBRARIES_DEV_PACKAGE_NAME "openvino-libraries-dev-${cpack_ver_mm}") + set(CPACK_DEBIAN_LIBRARIES_DEV_PACKAGE_NAME "openvino-libraries-dev-${cpack_name_ver}") # ov_debian_generate_conflicts(libraries_dev ${conflicting_versions}) ov_debian_add_lintian_suppression(libraries_dev # it's umbrella package @@ -242,7 +265,7 @@ macro(ov_cpack_settings) # all openvino set(CPACK_COMPONENT_OPENVINO_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Libraries and Development files") set(CPACK_COMPONENT_OPENVINO_DEPENDS "libraries_dev;samples;python_samples") - set(CPACK_DEBIAN_OPENVINO_PACKAGE_NAME "openvino-${cpack_ver_mm}") + set(CPACK_DEBIAN_OPENVINO_PACKAGE_NAME "openvino-${cpack_name_ver}") ov_debian_add_lintian_suppression(openvino # it's umbrella package "empty-binary-package") @@ -270,6 +293,6 @@ macro(ov_cpack_settings) ov_debian_add_latest_component(openvino) # users can manually install specific version of package - # e.g. sudo apt-get install openvino=2022.1.0-643 - # even if we have package version 2022.2.0 + # e.g. sudo apt-get install openvino=2022.1.0 + # even if we have latest package version 2022.2.0 endmacro() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index b7e2a7971dd..4702d7e4976 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -35,16 +35,8 @@ if(NOT ENABLE_DOCKER) foreach(target openvino_template_plugin template_extension openvino_template_extension) if(TARGET ${target}) - if(target MATCHES ".*_plugin$") - set(dest_location ${OV_CPACK_PLUGINSDIR}) - else() - set(dest_location ${OV_CPACK_RUNTIMEDIR}) - endif() - install(TARGETS ${target} - LIBRARY DESTINATION ${dest_location} - COMPONENT tests - EXCLUDE_FROM_ALL) + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) endif() endforeach() endif() diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt index 7423e9609be..58aac1551a4 100644 --- a/docs/snippets/CMakeLists.txt +++ b/docs/snippets/CMakeLists.txt @@ -61,15 +61,9 @@ if(NOT CMAKE_CROSSCOMPILING) endif() # remove OpenCV related sources -if (ENABLE_OPENCV) - find_package(OpenCV QUIET) -else() - set(OpenCV_FOUND OFF) -endif() - +find_package(OpenCV QUIET COMPONENTS core imgcodecs) if(NOT OpenCV_FOUND) - list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/dldt_optimization_guide5.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/ShapeInference.cpp") + list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ShapeInference.cpp") endif() # requires mfxFrameSurface1 and MSS API diff --git a/docs/snippets/ShapeInference.cpp b/docs/snippets/ShapeInference.cpp index 0fc462ab943..09fbfc4f99b 100644 --- a/docs/snippets/ShapeInference.cpp +++ b/docs/snippets/ShapeInference.cpp @@ -2,7 +2,6 @@ #include #include #include -#include int main() { ov::Core core; diff --git a/install_build_dependencies.sh b/install_build_dependencies.sh index b8b0c3c4153..81d40ad07d9 100755 --- a/install_build_dependencies.sh +++ b/install_build_dependencies.sh @@ -172,12 +172,13 @@ else echo "Unknown OS, please install build dependencies manually" fi -# cmake 3.17 or higher is required to build OpenVINO -current_cmake_version=$(cmake --version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') -required_cmake_ver=3.17 -if [ ! "$(printf '%s\n' "$required_cmake_ver" "$current_cmake_version" | sort -V | head -n1)" = "$required_cmake_ver" ]; then - wget "https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4.tar.gz" - tar xf cmake-3.18.4.tar.gz - (cd cmake-3.18.4 && ./bootstrap --parallel="$(nproc --all)" && make --jobs="$(nproc --all)" && sudo make install) - rm -rf cmake-3.18.4 cmake-3.18.4.tar.gz +# cmake 3.20 or higher is required to build OpenVINO +current_cmake_ver=$(cmake --version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') +required_cmake_ver=3.20.0 +if [ ! "$(printf '%s\n' "$required_cmake_ver" "$current_cmake_ver" | sort -V | head -n1)" = "$required_cmake_ver" ]; then + installed_cmake_ver=3.23.2 + wget "https://github.com/Kitware/CMake/releases/download/v${installed_cmake_ver}/cmake-${installed_cmake_ver}.tar.gz" + tar xf cmake-${installed_cmake_ver}.tar.gz + (cd cmake-${installed_cmake_ver} && ./bootstrap --parallel="$(nproc --all)" && make --jobs="$(nproc --all)" && sudo make install) + rm -rf cmake-${installed_cmake_ver} cmake-${installed_cmake_ver}.tar.gz fi diff --git a/licensing/CMakeLists.txt b/licensing/CMakeLists.txt index 48df2726802..f1c0129a4b5 100644 --- a/licensing/CMakeLists.txt +++ b/licensing/CMakeLists.txt @@ -8,6 +8,8 @@ ie_cpack_add_component(${OV_CPACK_COMP_LICENSING} HIDDEN) +# TODO: exclude from debian and use cmake/developer_package/packaging/copyright + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${OV_CPACK_DOCDIR}/licensing COMPONENT ${OV_CPACK_COMP_LICENSING} diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 0c12c1e9ed3..e292cfc8eeb 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -8,8 +8,8 @@ add_subdirectory(c) # used by tests_deprecated if(TARGET format_reader) install(TARGETS format_reader - RUNTIME DESTINATION ${OV_CPACK_RUNTIMEDIR} COMPONENT tests EXCLUDE_FROM_ALL - LIBRARY DESTINATION ${OV_CPACK_LIBRARYDIR} COMPONENT tests EXCLUDE_FROM_ALL) + RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) endif() openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader ie_samples_utils) diff --git a/samples/c/common/opencv_c_wrapper/CMakeLists.txt b/samples/c/common/opencv_c_wrapper/CMakeLists.txt index 2755579a0fe..f27e934793e 100644 --- a/samples/c/common/opencv_c_wrapper/CMakeLists.txt +++ b/samples/c/common/opencv_c_wrapper/CMakeLists.txt @@ -12,7 +12,7 @@ file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) add_library(${TARGET_NAME} SHARED ${HEADERS} ${SOURCES}) # Find OpenCV components if exist -find_package(OpenCV COMPONENTS core imgproc imgcodecs QUIET) +find_package(OpenCV QUIET COMPONENTS core imgproc imgcodecs) if(NOT OpenCV_FOUND) message(WARNING "OPENCV is disabled or not found, ${TARGET_NAME} is built without OPENCV support") else() diff --git a/samples/cpp/benchmark_app/CMakeLists.txt b/samples/cpp/benchmark_app/CMakeLists.txt index 56142151f70..f437e872525 100644 --- a/samples/cpp/benchmark_app/CMakeLists.txt +++ b/samples/cpp/benchmark_app/CMakeLists.txt @@ -65,7 +65,7 @@ endif() # Optional OpenCV dependency -find_package(OpenCV COMPONENTS core QUIET) +find_package(OpenCV QUIET COMPONENTS core) if(NOT OpenCV_FOUND) message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support. Set OpenCV_DIR") else() diff --git a/samples/cpp/common/format_reader/CMakeLists.txt b/samples/cpp/common/format_reader/CMakeLists.txt index e93e837adbf..44d94e8a27f 100644 --- a/samples/cpp/common/format_reader/CMakeLists.txt +++ b/samples/cpp/common/format_reader/CMakeLists.txt @@ -16,7 +16,7 @@ source_group("include" FILES ${LIBRARY_HEADERS}) add_library(${TARGET_NAME} SHARED ${MAIN_SRC} ${LIBRARY_HEADERS}) # Find OpenCV components if exist -find_package(OpenCV COMPONENTS core imgproc imgcodecs QUIET) +find_package(OpenCV QUIET COMPONENTS core imgproc imgcodecs) if(NOT OpenCV_FOUND) message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support") else() diff --git a/src/bindings/c/ov/src/CMakeLists.txt b/src/bindings/c/ov/src/CMakeLists.txt index d0d5655746b..bf776af7b33 100644 --- a/src/bindings/c/ov/src/CMakeLists.txt +++ b/src/bindings/c/ov/src/CMakeLists.txt @@ -30,15 +30,9 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} # export -set_target_properties(${TARGET_NAME} PROPERTIES - EXPORT_NAME runtime::ov) +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime::ov) -if(CPACK_GENERATOR STREQUAL "DEB") - # TODO: define proper library version, currently SOVERSION 2022 - set_target_properties(${TARGET_NAME} PROPERTIES - SOVERSION ${OpenVINO_VERSION_MAJOR} - VERSION ${OpenVINO_VERSION}) -endif() +ov_add_library_version(${TARGET_NAME}) export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/src/bindings/c/ov/tests/CMakeLists.txt b/src/bindings/c/ov/tests/CMakeLists.txt index c555e8a2669..72338f34e11 100644 --- a/src/bindings/c/ov/tests/CMakeLists.txt +++ b/src/bindings/c/ov/tests/CMakeLists.txt @@ -5,7 +5,7 @@ set(TARGET_NAME "OpenVinoCAPITests") # Find OpenCV components if exist -find_package(OpenCV COMPONENTS core imgproc imgcodecs QUIET) +find_package(OpenCV QUIET COMPONENTS core imgproc imgcodecs) if(NOT OpenCV_FOUND) message(WARNING "OPENCV is disabled or not found, ${TARGET_NAME} is disabled") return() diff --git a/src/bindings/c/src/CMakeLists.txt b/src/bindings/c/src/CMakeLists.txt index 734198c1220..36719c300a7 100644 --- a/src/bindings/c/src/CMakeLists.txt +++ b/src/bindings/c/src/CMakeLists.txt @@ -30,14 +30,9 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} # export -set_target_properties(${TARGET_NAME} PROPERTIES - EXPORT_NAME runtime::c) +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime::c) -if(CPACK_GENERATOR STREQUAL "DEB") - set_target_properties(${TARGET_NAME} PROPERTIES - SOVERSION ${OpenVINO_VERSION_MAJOR} - VERSION ${OpenVINO_VERSION}) -endif() +ov_add_library_version(${TARGET_NAME}) export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/src/bindings/c/tests/CMakeLists.txt b/src/bindings/c/tests/CMakeLists.txt index 94bbe1f53b2..0551e93cef0 100644 --- a/src/bindings/c/tests/CMakeLists.txt +++ b/src/bindings/c/tests/CMakeLists.txt @@ -5,7 +5,7 @@ set(TARGET_NAME "InferenceEngineCAPITests") # Find OpenCV components if exist -find_package(OpenCV COMPONENTS core imgproc imgcodecs QUIET) +find_package(OpenCV QUIET COMPONENTS core imgproc imgcodecs) if(NOT OpenCV_FOUND) message(WARNING "OPENCV is disabled or not found, ${TARGET_NAME} is disabled") return() diff --git a/src/bindings/python/tests/test_runtime/test_compiled_model.py b/src/bindings/python/tests/test_runtime/test_compiled_model.py index 1e73de5cffb..873a81d3a30 100644 --- a/src/bindings/python/tests/test_runtime/test_compiled_model.py +++ b/src/bindings/python/tests/test_runtime/test_compiled_model.py @@ -346,7 +346,12 @@ def test_direct_infer(device): def test_compiled_model_after_core_destroyed(device): - core, model = get_model_with_template_extension() + core = Core() + with open(test_net_bin, "rb") as f: + weights = f.read() + with open(test_net_xml, "rb") as f: + xml = f.read() + model = core.read_model(model=xml, weights=weights) compiled = core.compile_model(model, device) del core del model diff --git a/src/bindings/python/tests/test_runtime/test_core.py b/src/bindings/python/tests/test_runtime/test_core.py index 2a809774a9c..eebeb61f335 100644 --- a/src/bindings/python/tests/test_runtime/test_core.py +++ b/src/bindings/python/tests/test_runtime/test_core.py @@ -317,7 +317,7 @@ def test_unregister_plugin(device): with pytest.raises(RuntimeError) as e: core.load_network(model, device) assert ( - f"Device with '{device}' name is not registered in the InferenceEngine" + f"Device with '{device}' name is not registered in the OpenVINO Runtime" in str(e.value) ) diff --git a/src/bindings/python/tests/test_runtime/test_infer_request.py b/src/bindings/python/tests/test_runtime/test_infer_request.py index 8e692d9c1b3..ab4f46f221f 100644 --- a/src/bindings/python/tests/test_runtime/test_infer_request.py +++ b/src/bindings/python/tests/test_runtime/test_infer_request.py @@ -202,12 +202,8 @@ def test_set_tensors(device): assert np.allclose(tensor4.data, t9.data, atol=1e-2, rtol=1e-2) -@pytest.mark.dynamic_library() -@pytest.mark.template_extension() def test_batched_tensors(device): core = Core() - # TODO: remove when plugins will support set_input_tensors - core.register_plugin("openvino_template_plugin", "TEMPLATE") batch = 4 one_shape = [1, 2, 2, 2] @@ -230,7 +226,7 @@ def test_batched_tensors(device): model = Model([res1], [data1]) - compiled_model = core.compile_model(model, "TEMPLATE") + compiled_model = core.compile_model(model, device) req = compiled_model.create_infer_request() diff --git a/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py b/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py index c28cbc1dc7e..23bf9c8f914 100644 --- a/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py +++ b/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py @@ -69,7 +69,7 @@ def test_load_network_wrong_device(): net = ie.read_network(model=test_net_xml, weights=test_net_bin) with pytest.raises(RuntimeError) as e: ie.load_network(net, "BLA") - assert 'Device with "BLA" name is not registered in the InferenceEngine' in str(e.value) + assert 'Device with "BLA" name is not registered in the OpenVINO Runtime' in str(e.value) def test_query_network(device): @@ -123,7 +123,7 @@ def test_unregister_plugin(device): net = ie.read_network(model=test_net_xml, weights=test_net_bin) with pytest.raises(RuntimeError) as e: ie.load_network(net, device) - assert f"Device with '{device}' name is not registered in the InferenceEngine" in str(e.value) + assert f"Device with '{device}' name is not registered in the OpenVINO Runtime" in str(e.value) def test_available_devices(device): diff --git a/src/bindings/python/tests_compatibility/test_inference_engine/test_InferRequest.py b/src/bindings/python/tests_compatibility/test_inference_engine/test_InferRequest.py index 7740127a3bd..95ea512da7c 100644 --- a/src/bindings/python/tests_compatibility/test_inference_engine/test_InferRequest.py +++ b/src/bindings/python/tests_compatibility/test_inference_engine/test_InferRequest.py @@ -557,13 +557,11 @@ def test_query_state_write_buffer(device, input_shape, data_type, mode): "Expected values: {} \n Actual values: {} \n".format(expected_res, res) -@pytest.mark.template_plugin -def test_set_blob_with_incorrect_name(): +def test_set_blob_with_incorrect_name(device): function = create_encoder([4, 4, 20, 20]) net = ng.function_to_cnn(function) ie_core = ie.IECore() - ie_core.register_plugin("openvino_template_plugin", "TEMPLATE") - exec_net = ie_core.load_network(net, "TEMPLATE") + exec_net = ie_core.load_network(net, device) tensor_desc = exec_net.requests[0].input_blobs["data"].tensor_desc tensor_desc.dims = [4, 4, 20, 20] blob = ie.Blob(tensor_desc) @@ -572,13 +570,11 @@ def test_set_blob_with_incorrect_name(): assert f"Failed to find input or output with name: 'incorrect_name'" in str(e.value) -@pytest.mark.template_plugin -def test_set_blob_with_incorrect_size(): +def test_set_blob_with_incorrect_size(device): function = create_encoder([4, 4, 20, 20]) net = ng.function_to_cnn(function) ie_core = ie.IECore() - ie_core.register_plugin("openvino_template_plugin", "TEMPLATE") - exec_net = ie_core.load_network(net, "TEMPLATE") + exec_net = ie_core.load_network(net, device) tensor_desc = exec_net.requests[0].input_blobs["data"].tensor_desc tensor_desc.dims = [tensor_desc.dims[0]*2, 4, 20, 20] blob = ie.Blob(tensor_desc) diff --git a/src/cmake/openvino.cmake b/src/cmake/openvino.cmake index 538a7be63de..33757b0b3bc 100644 --- a/src/cmake/openvino.cmake +++ b/src/cmake/openvino.cmake @@ -102,11 +102,7 @@ ov_install_static_lib(${TARGET_NAME}_dev ${OV_CPACK_COMP_CORE}) list(APPEND PATH_VARS "IE_INCLUDE_DIR") -# TODO: dpkg-shlibdeps does not work otherwise -# TODO: define proper library version, currently SOVERSION 2022 -# set_target_properties(${TARGET_NAME} PROPERTIES -# SOVERSION ${OpenVINO_VERSION_MAJOR} -# VERSION ${OpenVINO_VERSION}) +ov_add_library_version(${TARGET_NAME}) if(ENABLE_INTEL_GNA) list(APPEND PATH_VARS "GNA_PATH") @@ -124,14 +120,10 @@ if(BUILD_SHARED_LIBS) DESTINATION ${OV_CPACK_PLUGINSDIR} COMPONENT ${OV_CPACK_COMP_CORE}) - # for InferenceEngineUnitTest - # For public tests - install(FILES $/plugins.xml - DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) - # For private tests - if (NOT WIN32) + if(ENABLE_TESTS) + # for InferenceEngineUnitTest install(FILES $/plugins.xml - DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) + DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) endif() endif() diff --git a/src/common/preprocessing/ie_preprocess_data.hpp b/src/common/preprocessing/ie_preprocess_data.hpp index 242fae5193b..4e6abdea42c 100644 --- a/src/common/preprocessing/ie_preprocess_data.hpp +++ b/src/common/preprocessing/ie_preprocess_data.hpp @@ -15,6 +15,7 @@ #include #include #include +#include "ie_version.hpp" namespace InferenceEngine { @@ -77,17 +78,31 @@ public: "Use 'cmake -DENABLE_GAPI_PREPROCESSING=ON ...'"; # endif // ENABLE_GAPI_PREPROCESSING #else - ov::util::FilePath libraryName = ov::util::to_file_path(std::string("openvino_gapi_preproc") + std::string(IE_BUILD_POSTFIX)); - ov::util::FilePath preprocLibraryPath = FileUtils::makePluginLibraryName(getInferenceEngineLibraryPath(), libraryName); + // preprocessing plugin can be found in the following locations + // 1. in openvino-X.Y.Z location relative to libopenvino.so + // 2. in the same folder as libopenvino.so - if (!FileUtils::fileExist(preprocLibraryPath)) { + ov::util::FilePath ovLibraryPath = getInferenceEngineLibraryPath(); + ov::util::FilePath libraryName = ov::util::to_file_path(std::string("openvino_gapi_preproc") + std::string(IE_BUILD_POSTFIX)); + libraryName = FileUtils::makePluginLibraryName({}, libraryName); + + std::ostringstream str; + str << "openvino-" << IE_VERSION_MAJOR << "." << IE_VERSION_MINOR << "." << IE_VERSION_PATCH; + ov::util::FilePath ovLibraryPathPlusOV = FileUtils::makePath(ovLibraryPath, ov::util::to_file_path(str.str())); + + const ov::util::FilePath preprocLibraryPathPlusOV = FileUtils::makePath(ovLibraryPathPlusOV, libraryName); + const ov::util::FilePath preprocLibraryPath = FileUtils::makePath(ovLibraryPath, libraryName); + const bool existsInOV = FileUtils::fileExist(preprocLibraryPathPlusOV); + const bool existsInLib = FileUtils::fileExist(preprocLibraryPath); + + if (!existsInOV && !existsInLib) { IE_THROW() << "Please, make sure that pre-processing library " - << ov::util::from_file_path(::FileUtils::makePluginLibraryName({}, libraryName)) << " is in " - << getIELibraryPath(); + << ov::util::from_file_path(libraryName) << " is in " + << ov::util::from_file_path(preprocLibraryPathPlusOV) << " or " << ov::util::from_file_path(preprocLibraryPath); } using CreateF = void(std::shared_ptr& data); - _so = ov::util::load_shared_object(preprocLibraryPath.c_str()); + _so = ov::util::load_shared_object(existsInOV ? preprocLibraryPathPlusOV.c_str() : preprocLibraryPath.c_str()); reinterpret_cast(ov::util::get_symbol(_so, "CreatePreProcessData"))(_ptr); #endif } diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp index 026d8df401b..d48e41a8c8b 100644 --- a/src/common/util/src/file_util.cpp +++ b/src/common/util/src/file_util.cpp @@ -328,10 +328,7 @@ static std::string get_ov_library_path_a() { #elif defined(__APPLE__) || defined(__linux__) Dl_info info; dladdr(reinterpret_cast(ov::util::get_ov_lib_path), &info); - std::string result = get_path_name(ov::util::get_absolute_file_path(info.dli_fname)).c_str(); - if (!ov::util::ends_with(result, "/lib") && !ov::util::ends_with(result, "/lib/")) - result = ov::util::path_join({result, "lib"}); - return result; + return get_path_name(ov::util::get_absolute_file_path(info.dli_fname)).c_str(); #else # error "Unsupported OS" #endif // _WIN32 diff --git a/src/core/tests/CMakeLists.txt b/src/core/tests/CMakeLists.txt index 6c3fe13b2bb..64f63448879 100644 --- a/src/core/tests/CMakeLists.txt +++ b/src/core/tests/CMakeLists.txt @@ -543,7 +543,7 @@ add_executable(ov_core_unit_tests ${SRC}) add_dependencies(ov_core_unit_tests template_extension) -target_include_directories(ov_core_unit_tests PRIVATE ".") +target_include_directories(ov_core_unit_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(ov_core_unit_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime) get_target_property(OV_CORE_SRC_DIR ngraph_obj SOURCE_DIR) diff --git a/src/core/tests/extension.cpp b/src/core/tests/extension.cpp index 4bc5961fd68..ffd6412d9de 100644 --- a/src/core/tests/extension.cpp +++ b/src/core/tests/extension.cpp @@ -6,6 +6,7 @@ #include +#include "common_test_utils/file_utils.hpp" #include "openvino/core/graph_util.hpp" #include "openvino/core/op_extension.hpp" #include "openvino/opsets/opset9.hpp" @@ -13,7 +14,8 @@ #include "so_extension.hpp" inline std::string get_extension_path() { - return ov::util::make_plugin_library_name({}, std::string("openvino_template_extension") + IE_BUILD_POSTFIX); + return ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string("openvino_template_extension") + IE_BUILD_POSTFIX); } TEST(extension, load_extension) { diff --git a/src/core/tests/frontend/CMakeLists.txt b/src/core/tests/frontend/CMakeLists.txt index 955a9cd65a9..cef9e3e8eb7 100644 --- a/src/core/tests/frontend/CMakeLists.txt +++ b/src/core/tests/frontend/CMakeLists.txt @@ -14,6 +14,8 @@ set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/mock_frontend.cpp) set(MOCK1_FE_NAME openvino_mock1_frontend) add_library(${MOCK1_FE_NAME} SHARED EXCLUDE_FROM_ALL ${SRC}) +ov_add_library_version(${MOCK1_FE_NAME}) + target_compile_definitions(${MOCK1_FE_NAME} PRIVATE "-DMOCK_VARIANT=\"1\"") target_include_directories(${MOCK1_FE_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) @@ -23,12 +25,6 @@ add_dependencies(ov_core_unit_tests ${MOCK1_FE_NAME}) add_clang_format_target(${MOCK1_FE_NAME}_clang FOR_TARGETS ${MOCK1_FE_NAME}) -if(BUILD_SHARED_LIBS) - install(TARGETS ${MOCK1_FE_NAME} - RUNTIME DESTINATION ${OV_CPACK_RUNTIMEDIR} COMPONENT tests OPTIONAL EXCLUDE_FROM_ALL - LIBRARY DESTINATION ${OV_CPACK_LIBRARYDIR} COMPONENT tests OPTIONAL EXCLUDE_FROM_ALL) -else() - install(TARGETS ${MOCK1_FE_NAME} - RUNTIME DESTINATION tests COMPONENT tests OPTIONAL EXCLUDE_FROM_ALL - LIBRARY DESTINATION tests COMPONENT tests OPTIONAL EXCLUDE_FROM_ALL) -endif() +install(TARGETS ${MOCK1_FE_NAME} + RUNTIME DESTINATION tests COMPONENT tests OPTIONAL EXCLUDE_FROM_ALL + LIBRARY DESTINATION tests COMPONENT tests OPTIONAL EXCLUDE_FROM_ALL) diff --git a/src/core/tests/frontend/frontend_manager.cpp b/src/core/tests/frontend/frontend_manager.cpp index 521b590e7bf..5061550c028 100644 --- a/src/core/tests/frontend/frontend_manager.cpp +++ b/src/core/tests/frontend/frontend_manager.cpp @@ -6,6 +6,7 @@ #include #include +#include "common_test_utils/file_utils.hpp" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "ngraph/file_util.hpp" @@ -24,46 +25,31 @@ # include #endif -#ifdef _WIN32 -const char FrontEndPathSeparator[] = ";"; -#else -const char FrontEndPathSeparator[] = ":"; -#endif // _WIN32 - -using namespace ngraph; using namespace ov::frontend; -static std::string find_my_pathname() { -#ifdef _WIN32 - HMODULE hModule = GetModuleHandleW(SHARED_LIB_PREFIX L"openvino" SHARED_LIB_SUFFIX); - WCHAR wpath[MAX_PATH]; - GetModuleFileNameW(hModule, wpath, MAX_PATH); - std::wstring ws(wpath); - std::string path(ws.begin(), ws.end()); - std::replace(path.begin(), path.end(), '\\', '/'); - NGRAPH_SUPPRESS_DEPRECATED_START - path = file_util::get_directory(path); - NGRAPH_SUPPRESS_DEPRECATED_END - path += "/"; - return path; -#elif defined(__linux) || defined(__APPLE__) - Dl_info dl_info; - dladdr(reinterpret_cast(ngraph::to_lower), &dl_info); - return ov::util::get_absolute_file_path(dl_info.dli_fname); -#else -# error "Unsupported OS" -#endif -} - static int set_test_env(const char* name, const char* value) { #ifdef _WIN32 return _putenv_s(name, value); #elif defined(__linux) || defined(__APPLE__) std::string var = std::string(name) + "=" + value; - return setenv(name, value, 0); + return setenv(name, value, 1); +#else +# error "Unsupported OS" #endif } +struct SetTestEnvrionment { + SetTestEnvrionment(const char* value = nullptr) { + NGRAPH_SUPPRESS_DEPRECATED_START + set_test_env("OV_FRONTEND_PATH", value ? value : CommonTestUtils::getExecutableDirectory().c_str()); + NGRAPH_SUPPRESS_DEPRECATED_END + } + + ~SetTestEnvrionment() { + set_test_env("OV_FRONTEND_PATH", ""); + } +}; + TEST(FrontEndManagerTest, testAvailableFrontEnds) { FrontEndManager fem; class MockFrontEnd : public FrontEnd {}; @@ -85,41 +71,51 @@ TEST(FrontEndManagerTest, testAvailableFrontEnds) { } TEST(FrontEndManagerTest, testMockPluginFrontEnd) { - NGRAPH_SUPPRESS_DEPRECATED_START - std::string fePath = ngraph::file_util::get_directory(find_my_pathname()); - fePath = fePath + FrontEndPathSeparator + "someInvalidPath"; - set_test_env("OV_FRONTEND_PATH", fePath.c_str()); + { + // with wring env + SetTestEnvrionment obj("someInvalidPath"); - FrontEndManager fem; - auto frontends = fem.get_available_front_ends(); - ASSERT_NE(std::find(frontends.begin(), frontends.end(), "mock1"), frontends.end()); - FrontEnd::Ptr fe; - ASSERT_NO_THROW(fe = fem.load_by_framework("mock1")); - ASSERT_EQ(fe->get_name(), "mock1"); - set_test_env("OV_FRONTEND_PATH", ""); - NGRAPH_SUPPRESS_DEPRECATED_END + FrontEndManager fem; + auto frontends = fem.get_available_front_ends(); + EXPECT_EQ(std::find(frontends.begin(), frontends.end(), "mock1"), frontends.end()); + } + + { + // update env + SetTestEnvrionment obj; + + FrontEndManager fem; + auto frontends = fem.get_available_front_ends(); + EXPECT_NE(std::find(frontends.begin(), frontends.end(), "mock1"), frontends.end()); + + FrontEnd::Ptr fe; + ASSERT_NO_THROW(fe = fem.load_by_framework("mock1")); + EXPECT_EQ(fe->get_name(), "mock1"); + } } TEST(FrontEndManagerTest, testFEMDestroy_FrontEndHolder) { FrontEnd::Ptr fe; { + SetTestEnvrionment obj; FrontEndManager fem; auto frontends = fem.get_available_front_ends(); - ASSERT_NE(std::find(frontends.begin(), frontends.end(), "mock1"), frontends.end()); + EXPECT_NE(std::find(frontends.begin(), frontends.end(), "mock1"), frontends.end()); ASSERT_NO_THROW(fe = fem.load_by_framework("mock1")); } - ASSERT_EQ(fe->get_name(), "mock1"); + EXPECT_EQ(fe->get_name(), "mock1"); } TEST(FrontEndManagerTest, testFEMDestroy_InputModelHolder) { InputModel::Ptr input_model; { + SetTestEnvrionment obj; std::shared_ptr model; FrontEndManager fem; auto fe = fem.load_by_framework("mock1"); input_model = fe->load("test"); model = fe->convert(input_model); - ASSERT_EQ(model->get_friendly_name(), "mock1_model"); + EXPECT_EQ(model->get_friendly_name(), "mock1_model"); } ASSERT_TRUE(input_model); } @@ -127,44 +123,46 @@ TEST(FrontEndManagerTest, testFEMDestroy_InputModelHolder) { TEST(FrontEndManagerTest, testFEMDestroy_OVModelHolder) { std::shared_ptr model; { + SetTestEnvrionment obj; FrontEndManager fem; auto fe = fem.load_by_framework("mock1"); auto input_model = fe->load("test"); model = fe->convert(input_model); - ASSERT_EQ(model->get_friendly_name(), "mock1_model"); - ASSERT_TRUE(model->get_rt_info().count("mock_test")); - ASSERT_EQ(model->get_rt_info()["mock_test"].as(), std::string(1024, 't')); + EXPECT_EQ(model->get_friendly_name(), "mock1_model"); + EXPECT_TRUE(model->get_rt_info().count("mock_test")); + EXPECT_EQ(model->get_rt_info()["mock_test"].as(), std::string(1024, 't')); } - ASSERT_EQ(model->get_friendly_name(), "mock1_model"); + EXPECT_EQ(model->get_friendly_name(), "mock1_model"); } TEST(FrontEndManagerTest, testFEMDestroy_OVModelHolder_Clone) { std::shared_ptr model_clone; { + SetTestEnvrionment obj; FrontEndManager fem; auto fe = fem.load_by_framework("mock1"); auto input_model = fe->load("test"); auto model = fe->convert(input_model); - ASSERT_EQ(model->get_friendly_name(), "mock1_model"); - ASSERT_TRUE(model->get_rt_info().count("mock_test")); - ASSERT_EQ(model->get_rt_info()["mock_test"].as(), std::string(1024, 't')); + EXPECT_EQ(model->get_friendly_name(), "mock1_model"); + EXPECT_TRUE(model->get_rt_info().count("mock_test")); + EXPECT_EQ(model->get_rt_info()["mock_test"].as(), std::string(1024, 't')); model_clone = ov::clone_model(*model); } - ASSERT_EQ(model_clone->get_rt_info()["mock_test"].as(), std::string(1024, 't')); - ASSERT_EQ(model_clone->get_friendly_name(), "mock1_model"); + EXPECT_EQ(model_clone->get_rt_info()["mock_test"].as(), std::string(1024, 't')); + EXPECT_EQ(model_clone->get_friendly_name(), "mock1_model"); } TEST(FrontEndManagerTest, testDefaultFrontEnd) { FrontEndManager fem; FrontEnd::Ptr fe; ASSERT_NO_THROW(fe = fem.load_by_model("")); - ASSERT_FALSE(fe); + ASSERT_EQ(nullptr, fe); class MockFrontEnd : public FrontEnd {}; std::unique_ptr fePtr(new MockFrontEnd()); // to verify base destructor fe = std::make_shared(); ASSERT_ANY_THROW(fe->load("")); - ASSERT_ANY_THROW(fe->convert(std::shared_ptr(nullptr))); + ASSERT_ANY_THROW(fe->convert(std::shared_ptr(nullptr))); ASSERT_ANY_THROW(fe->convert(InputModel::Ptr(nullptr))); ASSERT_ANY_THROW(fe->convert_partially(nullptr)); ASSERT_ANY_THROW(fe->decode(nullptr)); @@ -239,6 +237,8 @@ TEST(FrontEndManagerTest, testDefaultPlace) { ASSERT_ANY_THROW(place->is_equal_data(nullptr)); } +// clang-format off + TEST(FrontEndExceptionTest, frontend_general_error_no_throw) { EXPECT_NO_THROW(FRONT_END_GENERAL_CHECK(true)); } @@ -348,6 +348,7 @@ TEST(FrontEndExceptionTest, frontend_initialization_error_throw_info) { // FrontEndManager exception safety #define CHECK_EXCEPTION_FRONTEND(statement) \ try { \ + SetTestEnvrionment env; \ FrontEndManager fem; \ auto fe = fem.load_by_framework("mock1"); \ auto input_model = fe->load("throw_next"); \ @@ -361,34 +362,44 @@ TEST(FrontEndExceptionTest, frontend_initialization_error_throw_info) { TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Load_By_Framework) { EXPECT_ANY_THROW({ + SetTestEnvrionment env; FrontEndManager fem; auto fe = fem.load_by_framework("mock1"); fe->load("throw_now"); }); } -TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Convert){CHECK_EXCEPTION_FRONTEND(fe->convert(input_model))} +TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Convert){ + CHECK_EXCEPTION_FRONTEND(fe->convert(input_model)) +} -TEST(FrontEndManagerTest, - Exception_Safety_FrontEnd_Convert_OV_Model){CHECK_EXCEPTION_FRONTEND(fe->convert(std::shared_ptr()))} +TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Convert_OV_Model) { + CHECK_EXCEPTION_FRONTEND(fe->convert(std::shared_ptr())) +} -TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Get_Name){CHECK_EXCEPTION_FRONTEND(fe->get_name())} +TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Get_Name) { + CHECK_EXCEPTION_FRONTEND(fe->get_name()) +} TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Supported) { EXPECT_ANY_THROW({ + SetTestEnvrionment env; FrontEndManager fem; auto fe = fem.load_by_framework("mock1"); fe->supported("throw_now"); }); } -TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Add_Extension){ +TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Add_Extension) { CHECK_EXCEPTION_FRONTEND(fe->add_extension(std::make_shared()))} -TEST(FrontEndManagerTest, - Exception_Safety_FrontEnd_Convert_Partially){CHECK_EXCEPTION_FRONTEND(fe->convert_partially(input_model))} +TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Convert_Partially) { + CHECK_EXCEPTION_FRONTEND(fe->convert_partially(input_model)) +} -TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Normalize){CHECK_EXCEPTION_FRONTEND(fe->normalize(nullptr))} +TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Normalize) { + CHECK_EXCEPTION_FRONTEND(fe->normalize(nullptr)) +} TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Decode) { CHECK_EXCEPTION_FRONTEND(fe->decode(input_model)) @@ -398,6 +409,7 @@ TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Decode) { #define CHECK_EXCEPTION_INPUT_MODEL(statement) \ try { \ + SetTestEnvrionment env; \ FrontEndManager fem; \ auto fe = fem.load_by_framework("mock1"); \ auto input_model = fe->load("throw_model"); \ @@ -409,74 +421,97 @@ TEST(FrontEndManagerTest, Exception_Safety_FrontEnd_Decode) { FAIL() << "Unexpected error is thrown"; \ } -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_get_inputs){CHECK_EXCEPTION_INPUT_MODEL(input_model->get_inputs())} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_inputs) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_inputs()) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_get_outputs){CHECK_EXCEPTION_INPUT_MODEL(input_model->get_outputs())} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_outputs) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_outputs()) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_tensor_name){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_tensor_name({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_tensor_name) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_tensor_name({})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_operation_name){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_operation_name({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_operation_name) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_operation_name({})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_operation_name_and_input_port){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_operation_name_and_input_port({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_operation_name_and_input_port) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_operation_name_and_input_port({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_operation_name_and_output_port){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_operation_name_and_output_port({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_place_by_operation_name_and_output_port) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_place_by_operation_name_and_output_port({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_name_for_tensor){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->set_name_for_tensor({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_name_for_tensor) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->set_name_for_tensor({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_add_name_for_tensor){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->add_name_for_tensor({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_add_name_for_tensor) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->add_name_for_tensor({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_name_for_operation){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->set_name_for_operation({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_name_for_operation) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->set_name_for_operation({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_free_name_for_tensor){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->free_name_for_tensor({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_free_name_for_tensor) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->free_name_for_tensor({})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_free_name_for_operation){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->free_name_for_operation({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_free_name_for_operation) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->free_name_for_operation({})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_name_for_dimension){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->set_name_for_dimension({}, {}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_name_for_dimension) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->set_name_for_dimension({}, {}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_cut_and_add_new_input){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->cut_and_add_new_input({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_cut_and_add_new_input) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->cut_and_add_new_input({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_cut_and_add_new_output){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->cut_and_add_new_output({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_cut_and_add_new_output) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->cut_and_add_new_output({}, {})) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_add_output){CHECK_EXCEPTION_INPUT_MODEL(input_model->add_output({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_add_output) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->add_output({})) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_remove_output){CHECK_EXCEPTION_INPUT_MODEL(input_model->remove_output({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_remove_output) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->remove_output({})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_override_all_outputs){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->override_all_outputs({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_override_all_outputs) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->override_all_outputs({})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_override_all_inputs){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->override_all_inputs({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_override_all_inputs) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->override_all_inputs({})) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_extract_subgraph){CHECK_EXCEPTION_INPUT_MODEL(input_model->extract_subgraph({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_extract_subgraph) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->extract_subgraph({}, {})) +} -TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_partial_shape){ - CHECK_EXCEPTION_INPUT_MODEL(input_model->set_partial_shape({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_partial_shape) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->set_partial_shape({}, {})) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_get_partial_shape){CHECK_EXCEPTION_INPUT_MODEL(input_model->get_partial_shape({}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_get_partial_shape) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->get_partial_shape({})) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_set_element_type){CHECK_EXCEPTION_INPUT_MODEL(input_model->set_element_type({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_element_type) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->set_element_type({}, {})) +} -TEST(FrontEndManagerTest, - Exception_Safety_Input_Model_set_tensor_value){CHECK_EXCEPTION_INPUT_MODEL(input_model->set_tensor_value({}, {}))} +TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_tensor_value) { + CHECK_EXCEPTION_INPUT_MODEL(input_model->set_tensor_value({}, {})) +} TEST(FrontEndManagerTest, Exception_Safety_Input_Model_set_tensor_partial_value) { CHECK_EXCEPTION_INPUT_MODEL(input_model->set_tensor_partial_value({}, {}, {})) diff --git a/src/core/tests/frontend/onnx/conversion.cpp b/src/core/tests/frontend/onnx/conversion.cpp index 1d4b712156f..6a2293c40dd 100644 --- a/src/core/tests/frontend/onnx/conversion.cpp +++ b/src/core/tests/frontend/onnx/conversion.cpp @@ -4,6 +4,7 @@ #include "openvino/frontend/onnx/extension/conversion.hpp" +#include "common_test_utils/file_utils.hpp" #include "conversion_extension.hpp" #include "onnx_utils.hpp" #include "openvino/frontend/onnx/frontend.hpp" @@ -67,7 +68,8 @@ TEST(ONNXConversionExtensionTest, custom_op_with_custom_domain) { auto fe = std::make_shared(); fe->add_extension(ext); - const auto input_model = fe->load(ov::util::path_join({TEST_ONNX_MODELS_DIRNAME, "missing_op_domain.onnx"})); + const auto input_model = fe->load(CommonTestUtils::getModelFromTestModelZoo( + ov::util::path_join({TEST_ONNX_MODELS_DIRNAME, "missing_op_domain.onnx"}))); std::shared_ptr model; ASSERT_NO_THROW(model = fe->convert(input_model)); diff --git a/src/core/tests/frontend/paddle/places.cpp b/src/core/tests/frontend/paddle/places.cpp index abd966980a6..73b80b335da 100644 --- a/src/core/tests/frontend/paddle/places.cpp +++ b/src/core/tests/frontend/paddle/places.cpp @@ -54,7 +54,6 @@ std::vector tensor_names = { }; TEST(Paddle_Places, check_tensor_names) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -68,7 +67,6 @@ TEST(Paddle_Places, check_tensor_names) { } TEST(Paddle_Places, check_input_outputs) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -102,7 +100,6 @@ TEST(Paddle_Places, check_input_outputs) { // all existed in the model ops have "Out" port TEST(Paddle_Places, check_out_port_of_all_ops) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -125,7 +122,6 @@ TEST(Paddle_Places, check_out_port_of_all_ops) { } TEST(Paddle_Places, check_in_out_ports_of_model_outputs) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -160,7 +156,6 @@ TEST(Paddle_Places, check_in_out_ports_of_model_outputs) { } TEST(Paddle_Places, check_source_target_tensors_of_model_outputs) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -195,7 +190,6 @@ TEST(Paddle_Places, check_source_target_tensors_of_model_outputs) { } TEST(Paddle_Places, check_producing_consuming_ops_of_model_outputs) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -231,7 +225,6 @@ TEST(Paddle_Places, check_producing_consuming_ops_of_model_outputs) { // check data flow [ output port -> tensor -> input port ] TEST(Paddle_Places, check_data_flow) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -271,7 +264,6 @@ TEST(Paddle_Places, check_data_flow) { // -> input_port_N] // input_port, input_port_2, ... input_port_N are equal data TEST(Paddle_Places, check_tensor_to_multiple_ports) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -298,7 +290,6 @@ TEST(Paddle_Places, check_tensor_to_multiple_ports) { // consuming ops should be equal for tensor place and producing output port TEST(Paddle_Places, check_consuming_ops) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -340,7 +331,6 @@ TEST(Paddle_Places, check_consuming_ops) { } TEST(Paddle_Places, check_consuming_ops_2) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -380,7 +370,6 @@ TEST(Paddle_Places, check_consuming_ops_2) { } TEST(Paddle_Places, check_producing_ops) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -403,7 +392,6 @@ TEST(Paddle_Places, check_producing_ops) { } TEST(Paddle_Places, check_input_output_ports_dy_idx) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); @@ -430,7 +418,6 @@ TEST(Paddle_Places, check_input_output_ports_dy_idx) { } TEST(Paddle_Places, check_ops_tensors_by_idx) { - FrontEndTestUtils::setupTestEnv(); auto fem = FrontEndManager(); FrontEnd::Ptr frontend; ASSERT_NO_THROW(frontend = fem.load_by_framework(PADDLE_FE)); diff --git a/src/core/tests/pass/serialization/deterministicity.cpp b/src/core/tests/pass/serialization/deterministicity.cpp index 64f07aee93c..d330a3ca069 100644 --- a/src/core/tests/pass/serialization/deterministicity.cpp +++ b/src/core/tests/pass/serialization/deterministicity.cpp @@ -6,6 +6,7 @@ #include +#include "common_test_utils/file_utils.hpp" #include "openvino/pass/serialize.hpp" #include "openvino/util/file_util.hpp" #include "read_ir.hpp" @@ -49,7 +50,8 @@ protected: #ifdef ENABLE_OV_ONNX_FRONTEND TEST_F(SerializationDeterministicityTest, BasicModel) { - const std::string model = ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc.onnx"}); + const std::string model = + CommonTestUtils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc.onnx"})); auto expected = ov::test::readModel(model, ""); ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected); @@ -65,7 +67,8 @@ TEST_F(SerializationDeterministicityTest, BasicModel) { } TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) { - const std::string model = ov::util::path_join({SERIALIZED_ZOO, "ir/addmul_abc.onnx"}); + const std::string model = + CommonTestUtils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/addmul_abc.onnx"})); auto expected = ov::test::readModel(model, ""); ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected); @@ -83,8 +86,10 @@ TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) { #endif TEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) { - const std::string model = ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.xml"}); - const std::string weights = ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.bin"}); + const std::string model = + CommonTestUtils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.xml"})); + const std::string weights = + CommonTestUtils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.bin"})); auto expected = ov::test::readModel(model, weights); ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected); @@ -100,8 +105,10 @@ TEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) { } TEST_F(SerializationDeterministicityTest, ModelWithConstants) { - const std::string model = ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.xml"}); - const std::string weights = ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.bin"}); + const std::string model = + CommonTestUtils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.xml"})); + const std::string weights = + CommonTestUtils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.bin"})); auto expected = ov::test::readModel(model, weights); ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected); diff --git a/src/core/tests/pass/serialization/serialize.cpp b/src/core/tests/pass/serialization/serialize.cpp index 1537deed7d2..d0973053288 100644 --- a/src/core/tests/pass/serialization/serialize.cpp +++ b/src/core/tests/pass/serialization/serialize.cpp @@ -8,6 +8,7 @@ #include +#include "common_test_utils/file_utils.hpp" #include "common_test_utils/graph_comparator.hpp" #include "ngraph/pass/manager.hpp" #include "ngraph/pass/serialize.hpp" @@ -39,9 +40,11 @@ public: } void SetUp() override { - m_model_path = ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<0>(GetParam())}); + m_model_path = CommonTestUtils::getModelFromTestModelZoo( + ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<0>(GetParam())})); if (!std::get<1>(GetParam()).empty()) { - m_binary_path = ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<1>(GetParam())}); + m_binary_path = CommonTestUtils::getModelFromTestModelZoo( + ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<1>(GetParam())})); } const std::string test_name = GetTestName() + "_" + GetTimestamp(); diff --git a/src/frontends/common/CMakeLists.txt b/src/frontends/common/CMakeLists.txt index 1487a92e75c..d97c877c7aa 100644 --- a/src/frontends/common/CMakeLists.txt +++ b/src/frontends/common/CMakeLists.txt @@ -46,7 +46,7 @@ set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/manager.cpp APPEND PROPERTY COMPILE_DEFINITIONS FRONTEND_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}${FRONTEND_NAME_PREFIX}" - FRONTEND_LIB_SUFFIX="${FRONTEND_NAME_SUFFIX}${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") + FRONTEND_LIB_SUFFIX="${FRONTEND_NAME_SUFFIX}${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}${OpenVINO_VERSION_SUFFIX}") add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}_obj) diff --git a/src/frontends/tests/frontend/shared/CMakeLists.txt b/src/frontends/tests/frontend/shared/CMakeLists.txt index d1b0ef61dc8..2ab58dfdac0 100644 --- a/src/frontends/tests/frontend/shared/CMakeLists.txt +++ b/src/frontends/tests/frontend/shared/CMakeLists.txt @@ -24,8 +24,9 @@ target_link_libraries(${TARGET_NAME} cnpy # TODO: replace with nlohmann_json::nlohmann_json # but LTO fails for some reason - nlohmann_json_schema_validator - test_builtin_extensions_1 test_builtin_extensions_2) + nlohmann_json_schema_validator) + +add_dependencies(${TARGET_NAME} test_builtin_extensions_1 test_builtin_extensions_2) target_compile_definitions(${TARGET_NAME} PRIVATE diff --git a/src/frontends/tests/frontend/shared/src/conversion.cpp b/src/frontends/tests/frontend/shared/src/conversion.cpp index 82049b29c3a..e778b3c269c 100644 --- a/src/frontends/tests/frontend/shared/src/conversion.cpp +++ b/src/frontends/tests/frontend/shared/src/conversion.cpp @@ -7,6 +7,7 @@ #include #include +#include "common_test_utils/file_utils.hpp" #include "conversion_extension.hpp" #include "utils.hpp" @@ -29,7 +30,8 @@ void FrontEndConversionExtensionTest::initParamTest() { } inline std::string get_lib_path(const std::string& lib_name) { - return ov::util::make_plugin_library_name(ov::util::get_ov_lib_path(), lib_name + IE_BUILD_POSTFIX); + return ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + lib_name + IE_BUILD_POSTFIX); } /////////////////////////////////////////////////////////////////// diff --git a/src/frontends/tests/frontend/shared/src/json_config.cpp b/src/frontends/tests/frontend/shared/src/json_config.cpp index 991bb7522b8..3af42e3e856 100644 --- a/src/frontends/tests/frontend/shared/src/json_config.cpp +++ b/src/frontends/tests/frontend/shared/src/json_config.cpp @@ -10,6 +10,7 @@ #include #include +#include "common_test_utils/file_utils.hpp" #include "utils.hpp" using namespace ov::frontend; @@ -36,7 +37,8 @@ void FrontEndJsonConfigTest::initParamTest() { } inline std::string get_lib_path(const std::string& lib_name) { - return ov::util::make_plugin_library_name(ov::util::get_ov_lib_path(), lib_name + IE_BUILD_POSTFIX); + return ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + lib_name + IE_BUILD_POSTFIX); } void FrontEndJsonConfigTest::generate_json_config() { diff --git a/src/frontends/tests/frontend/shared/test_builtin_extensions_1/CMakeLists.txt b/src/frontends/tests/frontend/shared/test_builtin_extensions_1/CMakeLists.txt index 9b3f3236250..88784bf10ad 100644 --- a/src/frontends/tests/frontend/shared/test_builtin_extensions_1/CMakeLists.txt +++ b/src/frontends/tests/frontend/shared/test_builtin_extensions_1/CMakeLists.txt @@ -8,7 +8,6 @@ file(GLOB LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file(GLOB LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) set(DEPENDENCIES openvino::runtime::dev offline_transformations) -set(DEFINITIONS) if (ENABLE_OV_ONNX_FRONTEND) list(APPEND DEPENDENCIES openvino::frontend::onnx) @@ -26,18 +25,13 @@ if (ENABLE_OV_PADDLE_FRONTEND) endif() # Create library -add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS}) + +add_library(${TARGET_NAME} MODULE ${LIBRARY_SRC} ${LIBRARY_HEADERS}) + target_compile_definitions(${TARGET_NAME} PRIVATE ${DEFINITIONS}) target_link_libraries(${TARGET_NAME} PRIVATE ${DEPENDENCIES}) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) -if(WIN32) - install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL - LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) -else() - install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL - LIBRARY DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) -endif() +install(TARGETS ${TARGET_NAME} + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/src/frontends/tests/frontend/shared/test_builtin_extensions_2/CMakeLists.txt b/src/frontends/tests/frontend/shared/test_builtin_extensions_2/CMakeLists.txt index 8e47d6883f9..e01f60ec18f 100644 --- a/src/frontends/tests/frontend/shared/test_builtin_extensions_2/CMakeLists.txt +++ b/src/frontends/tests/frontend/shared/test_builtin_extensions_2/CMakeLists.txt @@ -8,18 +8,11 @@ file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) # Create library -add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS}) +add_library(${TARGET_NAME} MODULE ${LIBRARY_SRC} ${LIBRARY_HEADERS}) target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime::dev offline_transformations) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) -if(WIN32) - install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL - LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) -else() - install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL - LIBRARY DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) -endif() +install(TARGETS ${TARGET_NAME} + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/src/inference/src/ie_core.cpp b/src/inference/src/ie_core.cpp index 4971cbf5460..81b425f3f43 100644 --- a/src/inference/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -68,19 +68,68 @@ namespace { #ifndef OPENVINO_STATIC_LIBRARY -std::string parseXmlConfig(const std::string& xmlFile) { +std::string findPluginXML(const std::string& xmlFile) { std::string xmlConfigFile_ = xmlFile; if (xmlConfigFile_.empty()) { - // register plugins from default plugins.xml config + const auto ielibraryDir = ie::getInferenceEngineLibraryPath(); + + // plugins.xml can be found in either: + + // 1. openvino-X.Y.Z relative to libopenvino.so folder + std::ostringstream str; + str << "openvino-" << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH; + const auto subFolder = ov::util::to_file_path(str.str()); + + // register plugins from default openvino-/plugins.xml config ov::util::FilePath xmlConfigFileDefault = - FileUtils::makePath(ie::getInferenceEngineLibraryPath(), ov::util::to_file_path("plugins.xml")); - xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault); + FileUtils::makePath(FileUtils::makePath(ielibraryDir, subFolder), ov::util::to_file_path("plugins.xml")); + if (FileUtils::fileExist(xmlConfigFileDefault)) + return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault); + + // 2. in folder with libopenvino.so + xmlConfigFileDefault = FileUtils::makePath(ielibraryDir, ov::util::to_file_path("plugins.xml")); + if (FileUtils::fileExist(xmlConfigFileDefault)) + return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault); + + throw ov::Exception("Failed to find plugins.xml file"); } return xmlConfigFile_; } #endif +ov::util::FilePath getPluginPath(const std::string& pluginName, bool needAddSuffixes = false) { + const auto ieLibraryPath = ie::getInferenceEngineLibraryPath(); + + auto pluginPath = ov::util::to_file_path(pluginName.c_str()); + + // 0. user can provide a full path + if (FileUtils::fileExist(pluginPath)) + return pluginPath; + + if (needAddSuffixes) + pluginPath = FileUtils::makePluginLibraryName({}, pluginPath); + + // plugin can be found either: + + // 1. in openvino-X.Y.Z folder relative to libopenvino.so + std::ostringstream str; + str << "openvino-" << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH; + const auto subFolder = ov::util::to_file_path(str.str()); + + ov::util::FilePath absFilePath = FileUtils::makePath(FileUtils::makePath(ieLibraryPath, subFolder), pluginPath); + if (FileUtils::fileExist(absFilePath)) + return absFilePath; + + // 2. in the openvino.so location + absFilePath = FileUtils::makePath(ieLibraryPath, pluginPath); + if (FileUtils::fileExist(absFilePath)) + return absFilePath; + + // 3. in LD_LIBRARY_PATH on Linux / PATH on Windows + return pluginPath; +} + template Parsed parseDeviceNameIntoConfig(const std::string& deviceName, const std::map& config = {}) { auto config_ = config; @@ -502,19 +551,12 @@ public: FOREACH_CHILD (pluginNode, devicesNode, "plugin") { std::string deviceName = GetStrAttr(pluginNode, "name"); - ov::util::FilePath pluginPath = ov::util::to_file_path(GetStrAttr(pluginNode, "location").c_str()); + ov::util::FilePath pluginPath = getPluginPath(GetStrAttr(pluginNode, "location")); if (deviceName.find('.') != std::string::npos) { IE_THROW() << "Device name must not contain dot '.' symbol"; } - // append IR library path for default IE plugins - { - ov::util::FilePath absFilePath = FileUtils::makePath(ie::getInferenceEngineLibraryPath(), pluginPath); - if (FileUtils::fileExist(absFilePath)) - pluginPath = absFilePath; - } - // check properties auto propertiesNode = pluginNode.child("properties"); std::map config; @@ -886,6 +928,15 @@ public: } } + // BATCH case + { + if (deviceName.find("BATCH:") == 0) { + IE_THROW() + << "You can get specific metrics with the GetMetric only for the BATCH itself (without devices). " + "To get individual devices's metrics call GetMetric for each device separately"; + } + } + auto parsed = parseDeviceNameIntoConfig(deviceName); for (auto o : options) { parsed._config.insert(o); @@ -904,6 +955,9 @@ public: OPENVINO_ASSERT(device_name.find("AUTO:") != 0, "set_property is supported only for AUTO itself (without devices). " "You can configure the devices with set_property before creating the AUTO on top."); + OPENVINO_ASSERT(device_name.find("BATCH:") != 0, + "set_property is supported only for BATCH itself (without devices). " + "You can configure the devices with set_property before creating the BATCH on top."); ExtractAndSetDeviceConfig(properties); SetConfigForPlugins(any_copy(properties), device_name); @@ -923,14 +977,17 @@ public: Any get_property(const std::string& device_name, const std::string& name, const AnyMap& arguments) const override { OPENVINO_ASSERT(device_name.find("HETERO:") != 0, - "You can only get_config of the HETERO itself (without devices). " - "get_config is also possible for the individual devices before creating the HETERO on top."); + "You can only get_property of the HETERO itself (without devices). " + "get_property is also possible for the individual devices before creating the HETERO on top."); OPENVINO_ASSERT(device_name.find("MULTI:") != 0, - "You can only get_config of the MULTI itself (without devices). " - "get_config is also possible for the individual devices before creating the MULTI on top."); + "You can only get_property of the MULTI itself (without devices). " + "get_property is also possible for the individual devices before creating the MULTI on top."); OPENVINO_ASSERT(device_name.find("AUTO:") != 0, - "You can only get_config of the AUTO itself (without devices). " - "get_config is also possible for the individual devices before creating the AUTO on top."); + "You can only get_property of the AUTO itself (without devices). " + "get_property is also possible for the individual devices before creating the AUTO on top."); + OPENVINO_ASSERT(device_name.find("BATCH:") != 0, + "You can only get_property of the BATCH itself (without devices). " + "get_property is also possible for the individual devices before creating the BATCH on top."); if (device_name.empty()) { return get_property_for_core(name); @@ -1023,7 +1080,7 @@ public: if (pluginName == ov::DEFAULT_DEVICE_NAME) IE_THROW() << "No device is provided, so AUTO device is used by default, which failed loading."; else - IE_THROW() << "Device with \"" << deviceName << "\" name is not registered in the InferenceEngine"; + IE_THROW() << "Device with \"" << deviceName << "\" name is not registered in the OpenVINO Runtime"; } } std::lock_guard lock(get_mutex(deviceName)); @@ -1141,7 +1198,7 @@ public: std::lock_guard lock(get_mutex()); auto it = plugins.find(deviceName); if (it == plugins.end()) { - IE_THROW() << "Device with \"" << deviceName << "\" name is not registered in the InferenceEngine"; + IE_THROW() << "Device with \"" << deviceName << "\" name is not registered in the OpenVINO Runtime"; } plugins.erase(deviceName); @@ -1156,24 +1213,14 @@ public: auto it = pluginRegistry.find(deviceName); if (it != pluginRegistry.end()) { - IE_THROW() << "Device with \"" << deviceName << "\" is already registered in the InferenceEngine"; + IE_THROW() << "Device with \"" << deviceName << "\" is already registered in the OpenVINO Runtime"; } if (deviceName.find('.') != std::string::npos) { IE_THROW() << "Device name must not contain dot '.' symbol"; } - // append IR library path for default IE plugins - ov::util::FilePath pluginPath; - { - pluginPath = FileUtils::makePluginLibraryName({}, ov::util::to_file_path(pluginName.c_str())); - - ov::util::FilePath absFilePath = FileUtils::makePath(ie::getInferenceEngineLibraryPath(), pluginPath); - if (FileUtils::fileExist(absFilePath)) - pluginPath = absFilePath; - } - - PluginDescriptor desc{pluginPath}; + PluginDescriptor desc{getPluginPath(pluginName, true)}; pluginRegistry[deviceName] = desc; add_mutex(deviceName); } @@ -1241,7 +1288,7 @@ public: } if (!configIsSet && !deviceName.empty()) { - IE_THROW() << "Device with \"" << deviceName << "\" name is not registered in the InferenceEngine"; + IE_THROW() << "Device with \"" << deviceName << "\" name is not registered in the OpenVINO Runtime"; } // set config for already created plugins @@ -1552,7 +1599,7 @@ Core::Core(const std::string& xmlConfigFile) { #ifdef OPENVINO_STATIC_LIBRARY _impl->RegisterPluginsInRegistry(::getStaticPluginsRegistry()); #else - RegisterPlugins(ov::parseXmlConfig(xmlConfigFile)); + RegisterPlugins(ov::findPluginXML(xmlConfigFile)); #endif } @@ -1831,7 +1878,7 @@ Core::Core(const std::string& xmlConfigFile) { #ifdef OPENVINO_STATIC_LIBRARY _impl->RegisterPluginsInRegistry(::getStaticPluginsRegistry()); #else - register_plugins(parseXmlConfig(xmlConfigFile)); + register_plugins(findPluginXML(xmlConfigFile)); #endif } @@ -2014,6 +2061,7 @@ RemoteContext Core::create_context(const std::string& deviceName, const AnyMap& OPENVINO_ASSERT(deviceName.find("HETERO") != 0, "HETERO device does not support remote context"); OPENVINO_ASSERT(deviceName.find("MULTI") != 0, "MULTI device does not support remote context"); OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support remote context"); + OPENVINO_ASSERT(deviceName.find("BATCH") != 0, "BATCH device does not support remote context"); OV_CORE_CALL_STATEMENT({ auto parsed = parseDeviceNameIntoConfig(deviceName, flatten_sub_properties(deviceName, params)); @@ -2023,9 +2071,10 @@ RemoteContext Core::create_context(const std::string& deviceName, const AnyMap& } RemoteContext Core::get_default_context(const std::string& deviceName) { - OPENVINO_ASSERT(deviceName.find("HETERO") != 0, "HETERO device does not support remote context"); - OPENVINO_ASSERT(deviceName.find("MULTI") != 0, "MULTI device does not support remote context"); - OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support remote context"); + OPENVINO_ASSERT(deviceName.find("HETERO") != 0, "HETERO device does not support default remote context"); + OPENVINO_ASSERT(deviceName.find("MULTI") != 0, "MULTI device does not support default remote context"); + OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support default remote context"); + OPENVINO_ASSERT(deviceName.find("BATCH") != 0, "BATCH device does not support default remote context"); OV_CORE_CALL_STATEMENT({ auto parsed = parseDeviceNameIntoConfig(deviceName, AnyMap{}); diff --git a/src/inference/src/ie_network_reader.cpp b/src/inference/src/ie_network_reader.cpp index c3ad53e0dbe..ae7c10491d1 100644 --- a/src/inference/src/ie_network_reader.cpp +++ b/src/inference/src/ie_network_reader.cpp @@ -90,74 +90,54 @@ class Reader : public IReader { using ReaderPtr = ov::SoPtr; # endif ReaderPtr ptr; - std::once_flag readFlag; - std::string name; - std::string location; - - ReaderPtr getReaderPtr() { - std::call_once(readFlag, [&]() { -# ifdef OPENVINO_STATIC_LIBRARY - // call library creator directly, since we are in the same application - InferenceEngine::CreateReader(ptr); - OPENVINO_ASSERT(ptr != nullptr, "Failed to create static version of IR v7 reader"); -# else - ov::util::FilePath libraryName = ov::util::to_file_path(location); - ov::util::FilePath readersLibraryPath = - FileUtils::makePluginLibraryName(getInferenceEngineLibraryPath(), libraryName); - - if (!FileUtils::fileExist(readersLibraryPath)) { - IE_THROW() << "Please, make sure that Inference Engine reader library exists " - << ov::util::from_file_path(::FileUtils::makePluginLibraryName({}, libraryName)) << " is in " - << getIELibraryPath(); - } - - auto so = ov::util::load_shared_object(readersLibraryPath.c_str()); - std::shared_ptr plugin_impl; - using createFunc = void(std::shared_ptr&); - reinterpret_cast(ov::util::get_symbol(so, "CreateReader"))(plugin_impl); - ptr = {plugin_impl, so}; -# endif // OPENVINO_STATIC_LIBRARY - }); - - return ptr; - } - - ReaderPtr getReaderPtr() const { - return const_cast(this)->getReaderPtr(); - } public: using Ptr = std::shared_ptr; - Reader(const std::string& name, const std::string location) : name(name), location(location) {} + explicit Reader(const std::string& location) { +# ifdef OPENVINO_STATIC_LIBRARY + // call library creator directly, since we are in the same application + InferenceEngine::CreateReader(ptr); + OPENVINO_ASSERT(ptr != nullptr, "Failed to create static version of IR v7 reader"); +# else + ov::util::FilePath libraryPath = ov::util::to_file_path(FileUtils::makePluginLibraryName({}, location)); + ov::util::FilePath readersLibraryPath = FileUtils::makePath(getInferenceEngineLibraryPath(), libraryPath); + + if (FileUtils::fileExist(readersLibraryPath)) { + libraryPath = readersLibraryPath; + } + + auto so = ov::util::load_shared_object(libraryPath.c_str()); + std::shared_ptr plugin_impl; + using createFunc = void(std::shared_ptr&); + reinterpret_cast(ov::util::get_symbol(so, "CreateReader"))(plugin_impl); + ptr = {plugin_impl, so}; +# endif // OPENVINO_STATIC_LIBRARY + } + bool supportModel(std::istream& model) const override { OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Reader::supportModel"); - auto reader = getReaderPtr(); - return reader->supportModel(model); + return ptr->supportModel(model); } + CNNNetwork read(std::istream& model, const std::vector& exts) const override { - auto reader = getReaderPtr(); - return reader->read(model, exts); + return ptr->read(model, exts); } + CNNNetwork read(std::istream& model, const Blob::CPtr& weights, const std::vector& exts) const override { - auto reader = getReaderPtr(); - return reader->read(model, weights, exts); + return ptr->read(model, weights, exts); } + std::vector getDataFileExtensions() const override { - auto reader = getReaderPtr(); - return reader->getDataFileExtensions(); - } - std::string getName() const { - return name; + return ptr->getDataFileExtensions(); } }; namespace { -// Extension to plugins creator -std::multimap readers; +Reader::Ptr reader_irv7 = nullptr; void registerReaders() { OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "registerReaders"); @@ -167,42 +147,24 @@ void registerReaders() { if (initialized) return; - auto create_if_exists = [](const std::string name, const std::string library_name) { -# ifndef OPENVINO_STATIC_LIBRARY - ov::util::FilePath libraryName = ov::util::to_file_path(library_name); - ov::util::FilePath readersLibraryPath = - FileUtils::makePluginLibraryName(getInferenceEngineLibraryPath(), libraryName); - - if (!FileUtils::fileExist(readersLibraryPath)) - return std::shared_ptr(); -# endif // !OPENVINO_STATIC_LIBRARY - return std::make_shared(name, library_name); - }; + initialized = true; // try to load IR reader v7 if library exists - auto irReaderv7 = - create_if_exists("IRv7", std::string("inference_engine_ir_v7_reader") + std::string(IE_BUILD_POSTFIX)); - if (irReaderv7) - readers.emplace("xml", irReaderv7); - - initialized = true; + try { + reader_irv7 = + std::make_shared(std::string("inference_engine_ir_v7_reader") + std::string(IE_BUILD_POSTFIX)); + } catch (const std::runtime_error&) { + // runtime error is thrown in case of library cannot be loaded + } } void assertIfIRv7LikeModel(std::istream& modelStream) { auto irVersion = details::GetIRVersion(modelStream); bool isIRv7 = irVersion > 1 && irVersion <= 7; - if (!isIRv7) + if (!isIRv7 || reader_irv7) return; - for (auto&& kvp : readers) { - Reader::Ptr reader = kvp.second; - // if we have reader for IR v7 - if (reader->getName() == "IRv7") { - return; - } - } - IE_THROW() << "The support of IR v" << irVersion << " has been removed from the product. " "Please, convert the original model using the Model Optimizer which comes with this " @@ -226,60 +188,56 @@ CNNNetwork load_ir_v7_network(const std::string& modelPath, assertIfIRv7LikeModel(modelStream); - auto fileExt = modelPath.substr(modelPath.find_last_of(".") + 1); - for (auto it = readers.lower_bound(fileExt); it != readers.upper_bound(fileExt); it++) { - auto reader = it->second; - // Check that reader supports the model - if (reader->supportModel(modelStream)) { - // Find weights - std::string bPath = binPath; - if (bPath.empty()) { - auto pathWoExt = modelPath; - auto pos = modelPath.rfind('.'); - if (pos != std::string::npos) - pathWoExt = modelPath.substr(0, pos); - for (const auto& ext : reader->getDataFileExtensions()) { - bPath = pathWoExt + "." + ext; - if (!FileUtils::fileExist(bPath)) { - bPath.clear(); - } else { - break; - } + // Check that reader supports the model + if (reader_irv7 && reader_irv7->supportModel(modelStream)) { + // Find weights + std::string bPath = binPath; + if (bPath.empty()) { + auto pathWoExt = modelPath; + auto pos = modelPath.rfind('.'); + if (pos != std::string::npos) + pathWoExt = modelPath.substr(0, pos); + for (const auto& ext : reader_irv7->getDataFileExtensions()) { + bPath = pathWoExt + "." + ext; + if (!FileUtils::fileExist(bPath)) { + bPath.clear(); + } else { + break; } } - if (!bPath.empty()) { - // Open weights file -# if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring weights_path = ov::util::string_to_wstring(bPath.c_str()); -# else - std::string weights_path = bPath; -# endif - std::ifstream binStream; - binStream.open(weights_path, std::ios::binary); - if (!binStream.is_open()) - IE_THROW() << "Weights file " << bPath << " cannot be opened!"; - - binStream.seekg(0, std::ios::end); - size_t fileSize = binStream.tellg(); - binStream.seekg(0, std::ios::beg); - - Blob::Ptr weights = make_shared_blob({Precision::U8, {fileSize}, C}); - - { - OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::IE_RT, "ReadNetworkWeights"); - weights->allocate(); - binStream.read(weights->buffer(), fileSize); - binStream.close(); - } - - // read model with weights - auto network = reader->read(modelStream, weights, exts); - modelStream.close(); - return network; - } - // read model without weights - return reader->read(modelStream, exts); } + if (!bPath.empty()) { + // Open weights file +# if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) + std::wstring weights_path = ov::util::string_to_wstring(bPath.c_str()); +# else + std::string weights_path = bPath; +# endif + std::ifstream binStream; + binStream.open(weights_path, std::ios::binary); + if (!binStream.is_open()) + IE_THROW() << "Weights file " << bPath << " cannot be opened!"; + + binStream.seekg(0, std::ios::end); + size_t fileSize = binStream.tellg(); + binStream.seekg(0, std::ios::beg); + + Blob::Ptr weights = make_shared_blob({Precision::U8, {fileSize}, C}); + + { + OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::IE_RT, "ReadNetworkWeights"); + weights->allocate(); + binStream.read(weights->buffer(), fileSize); + binStream.close(); + } + + // read model with weights + auto network = reader_irv7->read(modelStream, weights, exts); + modelStream.close(); + return network; + } + // read model without weights + return reader_irv7->read(modelStream, exts); } return {}; @@ -537,14 +495,11 @@ CNNNetwork details::ReadNetwork(const std::string& model, registerReaders(); assertIfIRv7LikeModel(modelStream); - for (auto it = readers.begin(); it != readers.end(); it++) { - auto reader = it->second; - if (reader->supportModel(modelStream)) { - OPENVINO_ASSERT(!newAPI, "Cannot read IR v7 from OpenVINO 2.0 API"); - if (weights) - return reader->read(modelStream, weights, exts); - return reader->read(modelStream, exts); - } + if (reader_irv7 && reader_irv7->supportModel(modelStream)) { + OPENVINO_ASSERT(!newAPI, "Cannot read IR v7 from OpenVINO 2.0 API"); + if (weights) + return reader_irv7->read(modelStream, weights, exts); + return reader_irv7->read(modelStream, exts); } } #endif // ENABLE_IR_V7_READER diff --git a/src/tests/engines_util/CMakeLists.txt b/src/tests/engines_util/CMakeLists.txt index efd0cfb7ab4..44c415af710 100644 --- a/src/tests/engines_util/CMakeLists.txt +++ b/src/tests/engines_util/CMakeLists.txt @@ -9,7 +9,13 @@ add_library(engines_test_util STATIC EXCLUDE_FROM_ALL ${ENGINES_UTIL_SRC}) ie_faster_build(engines_test_util UNITY) target_link_libraries(engines_test_util PUBLIC openvino::runtime openvino::runtime::dev gtest gmock ngraph_test_util) -target_include_directories(engines_test_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(engines_test_util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") + +target_include_directories(engines_test_util + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/.." + PRIVATE + $) + add_clang_format_target(engines_test_util_clang FOR_SOURCES ${ENGINES_UTIL_SRC}) diff --git a/src/tests/engines_util/test_case.cpp b/src/tests/engines_util/test_case.cpp index a2c0fb2d273..bbd2640cb32 100644 --- a/src/tests/engines_util/test_case.cpp +++ b/src/tests/engines_util/test_case.cpp @@ -4,6 +4,8 @@ #include "test_case.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include "shared_utils.hpp" namespace { @@ -176,5 +178,17 @@ testing::AssertionResult TestCase::compare_results_with_tolerance_as_fp(float to return comparison_result; } +TestCase::TestCase(const std::shared_ptr& function, const std::string& dev) : m_function{function} { + try { + // Register template plugin + m_core.register_plugin( + ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string("openvino_template_plugin") + IE_BUILD_POSTFIX), + "TEMPLATE"); + } catch (...) { + } + m_request = m_core.compile_model(function, dev).create_infer_request(); +} + } // namespace test } // namespace ngraph diff --git a/src/tests/engines_util/test_case.hpp b/src/tests/engines_util/test_case.hpp index f7675b1fb7a..dcb9492ffb0 100644 --- a/src/tests/engines_util/test_case.hpp +++ b/src/tests/engines_util/test_case.hpp @@ -13,6 +13,7 @@ #include "ngraph/function.hpp" #include "ngraph/ngraph.hpp" #include "openvino/runtime/core.hpp" +#include "openvino/util/file_util.hpp" #include "test_tools.hpp" namespace ngraph { @@ -31,14 +32,7 @@ std::shared_ptr function_from_ir(const std::string& xml_path, const st class TestCase { public: - TestCase(const std::shared_ptr& function, const std::string& dev = "TEMPLATE") : m_function{function} { - try { - // Register template plugin - m_core.register_plugin(std::string("openvino_template_plugin") + IE_BUILD_POSTFIX, "TEMPLATE"); - } catch (...) { - } - m_request = m_core.compile_model(function, dev).create_infer_request(); - } + TestCase(const std::shared_ptr& function, const std::string& dev = "TEMPLATE"); template void add_input(const Shape& shape, const std::vector& values) { diff --git a/src/tests/functional/inference_engine/CMakeLists.txt b/src/tests/functional/inference_engine/CMakeLists.txt index ffdc80e5729..0ed5c9c7c36 100644 --- a/src/tests/functional/inference_engine/CMakeLists.txt +++ b/src/tests/functional/inference_engine/CMakeLists.txt @@ -33,10 +33,6 @@ if(ENABLE_OV_IR_FRONTEND) list(APPEND DEPENDENCIES openvino_ir_frontend) endif() -if(ENABLE_IR_V7_READER) - list(APPEND DEPENDENCIES inference_engine_ir_v7_reader) -endif() - if(ENABLE_HETERO) list(APPEND DEPENDENCIES openvino_hetero_plugin) endif() diff --git a/src/tests/functional/inference_engine/caching_test.cpp b/src/tests/functional/inference_engine/caching_test.cpp index 35f46344d37..ae8972ae45d 100644 --- a/src/tests/functional/inference_engine/caching_test.cpp +++ b/src/tests/functional/inference_engine/caching_test.cpp @@ -17,6 +17,7 @@ #include "ie_metric_helpers.hpp" #include "openvino/op/logical_not.hpp" +#include "openvino/util/file_util.hpp" #include "ie_remote_context.hpp" #include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp" #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" @@ -197,9 +198,10 @@ public: using CheckConfigCb = std::function &)>; CheckConfigCb m_checkConfigCb = nullptr; - static std::string get_mock_engine_name() { + static std::string get_mock_engine_path() { std::string mockEngineName("mock_engine"); - return CommonTestUtils::pre + mockEngineName + IE_BUILD_POSTFIX + CommonTestUtils::ext; + return ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + mockEngineName + IE_BUILD_POSTFIX); } static std::string generateTestFilePrefix() { @@ -288,8 +290,8 @@ public: initParamTest(); mockPlugin = std::make_shared(); setupMock(*mockPlugin); - std::string libraryName = get_mock_engine_name(); - sharedObjectLoader = ov::util::load_shared_object(libraryName.c_str()); + std::string libraryPath = get_mock_engine_path(); + sharedObjectLoader = ov::util::load_shared_object(libraryPath.c_str()); injectProxyEngine = make_std_function("InjectProxyEngine"); FuncTestUtils::TestModel::generateTestModel(modelName, weightsName); @@ -308,7 +310,8 @@ public: void testLoad(const std::function& func) { Core ie; injectProxyEngine(mockPlugin.get()); - ie.RegisterPlugin(std::string("mock_engine") + IE_BUILD_POSTFIX, deviceName); + ie.RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string("mock_engine") + IE_BUILD_POSTFIX), deviceName); func(ie); ie.UnregisterPlugin(deviceName); } diff --git a/src/tests/functional/inference_engine/cnn_network_test.cpp b/src/tests/functional/inference_engine/cnn_network_test.cpp index 6b6700a25b6..5802b6d08a3 100644 --- a/src/tests/functional/inference_engine/cnn_network_test.cpp +++ b/src/tests/functional/inference_engine/cnn_network_test.cpp @@ -8,6 +8,7 @@ #include "openvino/opsets/opset.hpp" #include "openvino/pass/serialize.hpp" #include +#include "openvino/util/file_util.hpp" using namespace InferenceEngine; @@ -154,7 +155,8 @@ public: void SetUp() override { std::shared_ptr model = CNNNetworkTests_create_model(); ov::pass::Serialize(modelName, weightsName).run_on_model(model); - core.RegisterPlugin(std::string("mock_engine") + IE_BUILD_POSTFIX, "mock"); + ASSERT_NO_THROW(core.RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string("mock_engine") + IE_BUILD_POSTFIX), "mock")); } void TearDown() override { diff --git a/src/tests/functional/inference_engine/core_threading.cpp b/src/tests/functional/inference_engine/core_threading.cpp index e25e52338cb..8f131fd22ae 100644 --- a/src/tests/functional/inference_engine/core_threading.cpp +++ b/src/tests/functional/inference_engine/core_threading.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include "openvino/util/file_util.hpp" #include #include #include @@ -54,7 +54,7 @@ public: void safeAddExtension(InferenceEngine::Core & ie) { try { auto extension = std::make_shared( - FileUtils::makePluginLibraryName({}, + ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), std::string("template_extension") + IE_BUILD_POSTFIX)); ie.AddExtension(extension); } catch (const InferenceEngine::Exception & ex) { @@ -84,7 +84,8 @@ TEST_F(CoreThreadingTests, RegisterPlugin) { std::atomic index{0}; runParallel([&] () { const std::string deviceName = std::to_string(index++); - ie.RegisterPlugin(std::string("mock_engine") + IE_BUILD_POSTFIX, deviceName); + ie.RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string("mock_engine") + IE_BUILD_POSTFIX), deviceName); ie.GetVersions(deviceName); ie.UnregisterPlugin(deviceName); }, 4000); @@ -97,12 +98,12 @@ TEST_F(CoreThreadingTests, RegisterPlugins) { auto getPluginXml = [&] () -> std::tuple { std::string indexStr = std::to_string(index++); - std::string pluginsXML = InferenceEngine::getIELibraryPath() + - ov::util::FileTraits::file_separator + - "test_plugins" + indexStr + ".xml"; + std::string pluginsXML = "test_plugins" + indexStr + ".xml"; std::ofstream file(pluginsXML); file << "::file_separator; file << ov::util::FileTraits::library_prefix(); file << "mock_engine"; file << IE_BUILD_POSTFIX; diff --git a/src/tests/functional/inference_engine/ir_serialization/custom_ops.cpp b/src/tests/functional/inference_engine/ir_serialization/custom_ops.cpp index 0e707074ad8..94e2aae3b99 100644 --- a/src/tests/functional/inference_engine/ir_serialization/custom_ops.cpp +++ b/src/tests/functional/inference_engine/ir_serialization/custom_ops.cpp @@ -24,11 +24,13 @@ #endif static std::string get_extension_path() { - return FileUtils::makePluginLibraryName({}, std::string("template_extension") + IE_BUILD_POSTFIX); + return FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), + std::string("template_extension") + IE_BUILD_POSTFIX); } static std::string get_ov_extension_path() { - return FileUtils::makePluginLibraryName({}, std::string("openvino_template_extension") + IE_BUILD_POSTFIX); + return FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), + std::string("openvino_template_extension") + IE_BUILD_POSTFIX); } class CustomOpsSerializationTest : public ::testing::Test { diff --git a/src/tests/functional/inference_engine/ov_extension_test.cpp b/src/tests/functional/inference_engine/ov_extension_test.cpp index cecb1d9f30b..3cac2f5c1c8 100644 --- a/src/tests/functional/inference_engine/ov_extension_test.cpp +++ b/src/tests/functional/inference_engine/ov_extension_test.cpp @@ -11,7 +11,8 @@ #include #include "common_test_utils/test_common.hpp" -#include "file_utils.h" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include "ie_iextension.h" #include "ngraph/op/op.hpp" #include "openvino/core/op_extension.hpp" @@ -174,7 +175,8 @@ public: namespace { std::string getOVExtensionPath() { - return FileUtils::makePluginLibraryName({}, std::string("openvino_template_extension") + IE_BUILD_POSTFIX); + return ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string("openvino_template_extension") + IE_BUILD_POSTFIX); } } // namespace diff --git a/src/tests/functional/inference_engine/ov_shared_object_test.cpp b/src/tests/functional/inference_engine/ov_shared_object_test.cpp index 342544b6e8d..bfd82d9747a 100644 --- a/src/tests/functional/inference_engine/ov_shared_object_test.cpp +++ b/src/tests/functional/inference_engine/ov_shared_object_test.cpp @@ -6,6 +6,7 @@ #include #include "openvino/util/shared_object.hpp" +#include "common_test_utils/file_utils.hpp" #include using namespace ::testing; @@ -14,7 +15,7 @@ using namespace std; class SharedObjectOVTests : public ::testing::Test { protected: std::string get_mock_engine_name() { - return FileUtils::makePluginLibraryName({}, + return FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), std::string("mock_engine") + IE_BUILD_POSTFIX); } diff --git a/src/tests/functional/inference_engine/shared_object_loader_test.cpp b/src/tests/functional/inference_engine/shared_object_loader_test.cpp index 6e65023e603..e7f496e5ad1 100644 --- a/src/tests/functional/inference_engine/shared_object_loader_test.cpp +++ b/src/tests/functional/inference_engine/shared_object_loader_test.cpp @@ -6,6 +6,7 @@ #include #include "openvino/util/shared_object.hpp" +#include "common_test_utils/file_utils.hpp" #include using namespace std; @@ -15,7 +16,7 @@ using namespace InferenceEngine::details; class SharedObjectLoaderTests: public ::testing::Test { protected: std::string get_mock_engine_name() { - return FileUtils::makePluginLibraryName({}, + return FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), std::string("mock_engine") + IE_BUILD_POSTFIX); } diff --git a/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/core_config.cpp b/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/core_config.cpp index 3c59a6625de..c4dc2bc00ef 100644 --- a/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/core_config.cpp +++ b/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/core_config.cpp @@ -3,6 +3,8 @@ // #include "functional_test_utils/core_config.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include "conformance.hpp" @@ -11,7 +13,8 @@ void CoreConfiguration(LayerTestsUtils::LayerTestsCommon* test) { auto availableDevices = core->GetAvailableDevices(); std::string targetDevice = std::string(ov::test::conformance::targetDevice); if (std::find(availableDevices.begin(), availableDevices.end(), targetDevice) == availableDevices.end()) { - core->RegisterPlugin(ov::test::conformance::targetPluginName, + core->RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string(ov::test::conformance::targetPluginName) + IE_BUILD_POSTFIX), ov::test::conformance::targetDevice); } } diff --git a/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/core_config.cpp b/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/core_config.cpp index 3c59a6625de..c4dc2bc00ef 100644 --- a/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/core_config.cpp +++ b/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/core_config.cpp @@ -3,6 +3,8 @@ // #include "functional_test_utils/core_config.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include "conformance.hpp" @@ -11,7 +13,8 @@ void CoreConfiguration(LayerTestsUtils::LayerTestsCommon* test) { auto availableDevices = core->GetAvailableDevices(); std::string targetDevice = std::string(ov::test::conformance::targetDevice); if (std::find(availableDevices.begin(), availableDevices.end(), targetDevice) == availableDevices.end()) { - core->RegisterPlugin(ov::test::conformance::targetPluginName, + core->RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), + std::string(ov::test::conformance::targetPluginName) + IE_BUILD_POSTFIX), ov::test::conformance::targetDevice); } } diff --git a/src/tests/functional/plugin/cpu/extension/extension.cpp b/src/tests/functional/plugin/cpu/extension/extension.cpp index e05b3c4d4cc..754bfb5e4fb 100644 --- a/src/tests/functional/plugin/cpu/extension/extension.cpp +++ b/src/tests/functional/plugin/cpu/extension/extension.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "common_test_utils/file_utils.hpp" class CustomAbsKernel : public InferenceEngine::ILayerExecImpl { public: @@ -199,7 +200,8 @@ TEST(Extension, XmlModelWithCustomAbs) { static std::string get_extension_path() { - return FileUtils::makePluginLibraryName({}, std::string("template_extension") + IE_BUILD_POSTFIX); + return FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), + std::string("template_extension") + IE_BUILD_POSTFIX); } diff --git a/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp b/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp index 2f374cd2152..34ecad74a24 100644 --- a/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp +++ b/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp @@ -7,6 +7,8 @@ #include "ov_behavior_test_utils.hpp" #include "functional_test_utils/plugin_cache.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" namespace BehaviorTestsUtils { @@ -105,9 +107,9 @@ inline InferenceEngine::Core createIECoreWithTemplate() { PluginCache::get().reset(); InferenceEngine::Core ie; #ifndef OPENVINO_STATIC_LIBRARY - std::string pluginName = "openvino_template_plugin"; - pluginName += IE_BUILD_POSTFIX; - ie.RegisterPlugin(pluginName, CommonTestUtils::DEVICE_TEMPLATE); + std::string pluginName = "openvino_template_plugin" IE_BUILD_POSTFIX; + ie.RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName), + CommonTestUtils::DEVICE_TEMPLATE); #endif // !OPENVINO_STATIC_LIBRARY return ie; } diff --git a/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp b/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp index 6f0a9914be1..f3924c40699 100644 --- a/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp +++ b/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp @@ -11,6 +11,8 @@ #include "common_test_utils/test_common.hpp" #include "common_test_utils/test_constants.hpp" #include "common_test_utils/common_utils.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include "functional_test_utils/plugin_cache.hpp" #include "functional_test_utils/ov_plugin_cache.hpp" @@ -87,7 +89,8 @@ inline ov::Core createCoreWithTemplate() { #ifndef OPENVINO_STATIC_LIBRARY std::string pluginName = "openvino_template_plugin"; pluginName += IE_BUILD_POSTFIX; - core.register_plugin(pluginName, CommonTestUtils::DEVICE_TEMPLATE); + core.register_plugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName), + CommonTestUtils::DEVICE_TEMPLATE); #endif // !OPENVINO_STATIC_LIBRARY return core; } diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp index 4cfbf3473e5..6ede5ace7e1 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp @@ -10,6 +10,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/file_utils.hpp" #include "common_test_utils/unicode_utils.hpp" +#include "openvino/util/file_util.hpp" #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT # include @@ -40,6 +41,9 @@ public: SKIP_IF_CURRENT_TEST_IS_DISABLED(); std::tie(pluginName, deviceName) = GetParam(); pluginName += IE_BUILD_POSTFIX; + if (pluginName == (std::string("openvino_template_plugin") + IE_BUILD_POSTFIX)) { + pluginName = ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName); + } } }; @@ -148,22 +152,28 @@ TEST_P(OVClassBasicTestP, registerNewPluginNoThrows) { OV_ASSERT_NO_THROW(ie.get_property("NEW_DEVICE_NAME", ov::supported_properties)); } -TEST(OVClassBasicTest, smoke_registerExistingPluginFileThrows) { +TEST(OVClassBasicTest, smoke_registerNonExistingPluginFileThrows) { ov::Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.register_plugins("nonExistPlugins.xml"), ov::Exception); - ASSERT_THROW(ie.register_plugins("nonExistPlugins.xml"), ov::Exception); } TEST(OVClassBasicTest, smoke_createNonExistingConfigThrows) { ASSERT_THROW(ov::Core ie("nonExistPlugins.xml"), ov::Exception); } -#ifdef __linux__ +inline std::string getPluginFile() { + std::string filename{"mock_engine_valid.xml"}; + std::ostringstream stream; + stream << ""; + CommonTestUtils::createFile(filename, stream.str()); + return filename; +} TEST(OVClassBasicTest, smoke_createMockEngineConfigNoThrows) { - std::string filename{"mock_engine_valid.xml"}; - std::string content{""}; - CommonTestUtils::createFile(filename, content); + const std::string filename = getPluginFile(); OV_ASSERT_NO_THROW(ov::Core ie(filename)); CommonTestUtils::removeFile(filename.c_str()); } @@ -176,14 +186,10 @@ TEST(OVClassBasicTest, smoke_createMockEngineConfigThrows) { CommonTestUtils::removeFile(filename.c_str()); } -#endif - #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT TEST_P(OVClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { - std::string pluginXML{"mock_engine_valid.xml"}; - std::string content{""}; - CommonTestUtils::createFile(pluginXML, content); + const std::string pluginXML = getPluginFile(); for (std::size_t testIndex = 0; testIndex < CommonTestUtils::test_unicode_postfix_vector.size(); testIndex++) { GTEST_COUT << testIndex; @@ -204,9 +210,7 @@ TEST_P(OVClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { GTEST_COUT << "Core created " << testIndex << std::endl; OV_ASSERT_NO_THROW(ie.register_plugins(::ov::util::wstring_to_string(pluginsXmlW))); CommonTestUtils::removeFile(pluginsXmlW); -# if defined __linux__ && !defined(__APPLE__) OV_ASSERT_NO_THROW(ie.get_versions("mock")); // from pluginXML -# endif OV_ASSERT_NO_THROW(ie.get_versions(deviceName)); GTEST_COUT << "Plugin created " << testIndex << std::endl; diff --git a/src/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp b/src/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp index 72ff8fcae61..e30f22b12d7 100644 --- a/src/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp @@ -12,6 +12,7 @@ #include "common_test_utils/test_assertions.hpp" #include "common_test_utils/file_utils.hpp" #include "common_test_utils/unicode_utils.hpp" +#include "openvino/util/file_util.hpp" #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT #include @@ -38,6 +39,9 @@ public: SKIP_IF_CURRENT_TEST_IS_DISABLED(); std::tie(pluginName, deviceName) = GetParam(); pluginName += IE_BUILD_POSTFIX; + if (pluginName == (std::string("openvino_template_plugin") + IE_BUILD_POSTFIX)) { + pluginName = ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName); + } } }; @@ -122,7 +126,7 @@ TEST_P(IEClassBasicTestP, registerNewPluginNoThrows) { ASSERT_NO_THROW(ie.GetMetric("NEW_DEVICE_NAME", METRIC_KEY(SUPPORTED_CONFIG_KEYS))); } -TEST(IEClassBasicTest, smoke_registerExistingPluginFileThrows) { +TEST(IEClassBasicTest, smoke_registerNonExistingPluginFileThrows) { InferenceEngine::Core ie = BehaviorTestsUtils::createIECoreWithTemplate(); ASSERT_THROW(ie.RegisterPlugins("nonExistPlugins.xml"), InferenceEngine::Exception); } @@ -131,12 +135,19 @@ TEST(IEClassBasicTest, smoke_createNonExistingConfigThrows) { ASSERT_THROW(InferenceEngine::Core ie("nonExistPlugins.xml"), InferenceEngine::Exception); } -#ifdef __linux__ +inline std::string getPluginFile() { + std::string filename{"mock_engine_valid.xml"}; + std::ostringstream stream; + stream << ""; + CommonTestUtils::createFile(filename, stream.str()); + return filename; +} TEST(IEClassBasicTest, smoke_createMockEngineConfigNoThrows) { - std::string filename{"mock_engine_valid.xml"}; - std::string content{""}; - CommonTestUtils::createFile(filename, content); + const std::string filename = getPluginFile(); ASSERT_NO_THROW(InferenceEngine::Core ie(filename)); CommonTestUtils::removeFile(filename.c_str()); } @@ -149,14 +160,10 @@ TEST(IEClassBasicTest, smoke_createMockEngineConfigThrows) { CommonTestUtils::removeFile(filename.c_str()); } -#endif - #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { - std::string pluginXML{"mock_engine_valid.xml"}; - std::string content{""}; - CommonTestUtils::createFile(pluginXML, content); + const std::string pluginXML = getPluginFile(); for (std::size_t testIndex = 0; testIndex < CommonTestUtils::test_unicode_postfix_vector.size(); testIndex++) { GTEST_COUT << testIndex; @@ -176,9 +183,7 @@ TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { GTEST_COUT << "Core created " << testIndex << std::endl; ASSERT_NO_THROW(ie.RegisterPlugins(ov::util::wstring_to_string(pluginsXmlW))); CommonTestUtils::removeFile(pluginsXmlW); -#if defined __linux__ && !defined(__APPLE__) - ASSERT_NO_THROW(ie.GetVersions("mock")); // from pluginXML -#endif + ASSERT_NO_THROW(ie.GetVersions("mock")); // from pluginXM ASSERT_NO_THROW(ie.GetVersions(deviceName)); GTEST_COUT << "Plugin created " << testIndex << std::endl; diff --git a/src/tests/functional/plugin/shared/include/behavior/plugin/core_threading.hpp b/src/tests/functional/plugin/shared/include/behavior/plugin/core_threading.hpp index f4c2d63ed57..1d2227b2cca 100644 --- a/src/tests/functional/plugin/shared/include/behavior/plugin/core_threading.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/plugin/core_threading.hpp @@ -62,7 +62,7 @@ public: void safeAddExtension(InferenceEngine::Core & ie) { try { auto extension = std::make_shared( - FileUtils::makePluginLibraryName({}, "template_extension")); + FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), "template_extension")); ie.AddExtension(extension); } catch (const InferenceEngine::Exception & ex) { ASSERT_STR_CONTAINS(ex.what(), "name: experimental"); diff --git a/src/tests/functional/plugin/shared/src/behavior/plugin/hetero_synthetic.cpp b/src/tests/functional/plugin/shared/src/behavior/plugin/hetero_synthetic.cpp index 040e22bf53d..b4bf13b57e0 100644 --- a/src/tests/functional/plugin/shared/src/behavior/plugin/hetero_synthetic.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/plugin/hetero_synthetic.cpp @@ -7,8 +7,11 @@ #include #include "ngraph_functions/builders.hpp" #include "ngraph_functions/subgraph_builders.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include #include "ie_algorithm.hpp" + namespace HeteroTests { static std::vector()>> builders = { @@ -115,11 +118,17 @@ void HeteroSyntheticTest::SetUp() { for (auto&& pluginParameter : std::get(param)) { bool registred = true; try { - PluginCache::get().ie()->RegisterPlugin(pluginParameter._location - + IE_BUILD_POSTFIX, pluginParameter._name); + if (pluginParameter._location == "openvino_template_plugin") { + PluginCache::get().ie()->RegisterPlugin(ov::util::make_plugin_library_name( + CommonTestUtils::getExecutableDirectory(), pluginParameter._location + IE_BUILD_POSTFIX), + pluginParameter._name); + } else { + PluginCache::get().ie()->RegisterPlugin(pluginParameter._location + + IE_BUILD_POSTFIX, pluginParameter._name); + } } catch (InferenceEngine::Exception& ex) { if (std::string{ex.what()}.find("Device with \"" + pluginParameter._name - + "\" is already registered in the InferenceEngine") + + "\" is already registered in the OpenVINO Runtime") == std::string::npos) { throw ex; } else { diff --git a/src/tests/ie_test_utils/functional_test_utils/src/ov_plugin_cache.cpp b/src/tests/ie_test_utils/functional_test_utils/src/ov_plugin_cache.cpp index f44035b0e38..0a776378044 100644 --- a/src/tests/ie_test_utils/functional_test_utils/src/ov_plugin_cache.cpp +++ b/src/tests/ie_test_utils/functional_test_utils/src/ov_plugin_cache.cpp @@ -3,6 +3,8 @@ // #include "functional_test_utils/ov_plugin_cache.hpp" +#include "common_test_utils/file_utils.hpp" +#include "openvino/util/file_util.hpp" #include @@ -56,7 +58,7 @@ std::shared_ptr PluginCache::core(const std::string &deviceToCheck) { try { std::string pluginName = "openvino_template_plugin"; pluginName += IE_BUILD_POSTFIX; - ov_core->register_plugin(pluginName, "TEMPLATE"); + ov_core->register_plugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName), "TEMPLATE"); } catch (...) { } diff --git a/src/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp b/src/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp index 1aa843e0a68..23cd9a21095 100644 --- a/src/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp +++ b/src/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp @@ -4,12 +4,14 @@ #include "functional_test_utils/plugin_cache.hpp" #include "functional_test_utils/ov_plugin_cache.hpp" +#include "common_test_utils/file_utils.hpp" #include #include #include #include +#include "openvino/util/file_util.hpp" namespace { class TestListener : public testing::EmptyTestEventListener { @@ -58,7 +60,7 @@ std::shared_ptr PluginCache::ie(const std::string &device try { std::string pluginName = "openvino_template_plugin"; pluginName += IE_BUILD_POSTFIX; - ie_core->RegisterPlugin(pluginName, "TEMPLATE"); + ie_core->RegisterPlugin(ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName), "TEMPLATE"); } catch (...) {} if (!deviceToCheck.empty()) { diff --git a/src/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt b/src/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt index 3eb3310619d..056fafd74fa 100644 --- a/src/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt +++ b/src/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt @@ -40,4 +40,4 @@ target_link_libraries(${TARGET_NAME} PRIVATE inference_engine) target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN) install(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION ${OV_CPACK_PLUGINSDIR} COMPONENT tests EXCLUDE_FROM_ALL) + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/src/tests/unit/gna/CMakeLists.txt b/src/tests/unit/gna/CMakeLists.txt index fc10f0bd6f3..df95c44d8e2 100644 --- a/src/tests/unit/gna/CMakeLists.txt +++ b/src/tests/unit/gna/CMakeLists.txt @@ -16,10 +16,10 @@ addIeTargetTest( LINK_LIBRARIES PRIVATE ngraphFunctions - gmock - commonTestUtils_s - openvino_intel_gna_plugin_test_static - engines_test_util + gmock + commonTestUtils_s + openvino_intel_gna_plugin_test_static + engines_test_util ADD_CPPLINT LABELS GNA diff --git a/src/tests/unit/inference_engine/CMakeLists.txt b/src/tests/unit/inference_engine/CMakeLists.txt index dd15fadc9a3..10ec6899043 100644 --- a/src/tests/unit/inference_engine/CMakeLists.txt +++ b/src/tests/unit/inference_engine/CMakeLists.txt @@ -5,7 +5,7 @@ set(TARGET_NAME ieUnitTests) # Find OpenCV components if exist -find_package(OpenCV COMPONENTS core QUIET) +find_package(OpenCV QUIET COMPONENTS core) if(NOT OpenCV_FOUND) message(WARNING "OPENCV is disabled or not found, ${TARGET_NAME} needs OpenCV for its build") else() diff --git a/src/tests/unit/inference_engine/ie_extension_test.cpp b/src/tests/unit/inference_engine/ie_extension_test.cpp index a33ae9f66cf..12675f118ea 100644 --- a/src/tests/unit/inference_engine/ie_extension_test.cpp +++ b/src/tests/unit/inference_engine/ie_extension_test.cpp @@ -12,13 +12,14 @@ #include #include "common_test_utils/test_common.hpp" +#include "common_test_utils/file_utils.hpp" using namespace InferenceEngine; using ExtensionTests = ::testing::Test; std::string getExtensionPath() { - return FileUtils::makePluginLibraryName({}, + return FileUtils::makePluginLibraryName(CommonTestUtils::getExecutableDirectory(), std::string("template_extension") + IE_BUILD_POSTFIX); } diff --git a/src/tests_deprecated/fluid_preproc/CMakeLists.txt b/src/tests_deprecated/fluid_preproc/CMakeLists.txt index a3a39e9faf6..b7d00e68bed 100644 --- a/src/tests_deprecated/fluid_preproc/CMakeLists.txt +++ b/src/tests_deprecated/fluid_preproc/CMakeLists.txt @@ -4,7 +4,7 @@ set(TARGET fluid_preproc_tests) -find_package(OpenCV COMPONENTS gapi core imgproc QUIET) +find_package(OpenCV QUIET COMPONENTS gapi core imgproc) if(NOT OpenCV_FOUND) message(WARNING "No suitable OpenCV version detected, ${TARGET} skipped") return() diff --git a/src/tests_deprecated/fluid_preproc/common/fluid_tests.cpp b/src/tests_deprecated/fluid_preproc/common/fluid_tests.cpp index f64e3ea1118..809c2319d44 100644 --- a/src/tests_deprecated/fluid_preproc/common/fluid_tests.cpp +++ b/src/tests_deprecated/fluid_preproc/common/fluid_tests.cpp @@ -98,10 +98,6 @@ cv::String typeToString(int type) case CV_8UC2 : return "CV_8UC2"; case CV_8UC3 : return "CV_8UC3"; case CV_8UC4 : return "CV_8UC4"; - case CV_16FC1 : return "CV_16FC1"; - case CV_16FC2 : return "CV_16FC2"; - case CV_16FC3 : return "CV_16FC3"; - case CV_16FC4 : return "CV_16FC4"; case CV_32FC1 : return "CV_32FC1"; case CV_32FC2 : return "CV_32FC2"; case CV_32FC3 : return "CV_32FC3"; diff --git a/src/tests_deprecated/functional/shared_tests/CMakeLists.txt b/src/tests_deprecated/functional/shared_tests/CMakeLists.txt index f4534bb824b..379068afbf0 100644 --- a/src/tests_deprecated/functional/shared_tests/CMakeLists.txt +++ b/src/tests_deprecated/functional/shared_tests/CMakeLists.txt @@ -37,7 +37,7 @@ ie_faster_build(${TARGET_NAME} ) # Find OpenCV components if exist -find_package(OpenCV COMPONENTS core imgproc QUIET) +find_package(OpenCV QUIET COMPONENTS core imgproc) if(OpenCV_FOUND) target_compile_definitions(${TARGET_NAME} PUBLIC USE_OPENCV) else() diff --git a/src/tests_deprecated/functional/shared_tests/io_blob_tests/cropResize_tests.hpp b/src/tests_deprecated/functional/shared_tests/io_blob_tests/cropResize_tests.hpp index b5e39d0b39d..99965680241 100644 --- a/src/tests_deprecated/functional/shared_tests/io_blob_tests/cropResize_tests.hpp +++ b/src/tests_deprecated/functional/shared_tests/io_blob_tests/cropResize_tests.hpp @@ -285,7 +285,7 @@ TEST_P(RandomROITest, PreprocRandomROITest) } case Precision::FP16: { - cv::Mat mat(h, w, CV_16FC3, cv::Scalar(0,0, 255)); + cv::Mat mat(h, w, CV_16SC3, cv::Scalar(0,0, 255)); cv::randu(mat, cv::Scalar(0, 0, 0), cv::Scalar(255,255, 255)); blob = img2Blob(mat, _inputLayout); break; @@ -314,7 +314,7 @@ TEST_P(RandomROITest, PreprocRandomROITest) } case Precision::FP16: { - cv::Mat mat(h, w, CV_16FC3); + cv::Mat mat(h, w, CV_16SC3); cv::randu(mat, cv::Scalar(0, 0, 0), cv::Scalar(255,255, 255)); cv::cvtColor(mat, mat, toCvtColorType(_colorFormat)); blob = img2Blob(mat, _inputLayout); @@ -347,7 +347,7 @@ TEST_P(RandomROITest, PreprocRandomROITest) } case Precision::FP16: { - cv::Mat mat(h, w, CV_16FC4); + cv::Mat mat(h, w, CV_16SC4); cv::randu(mat, cv::Scalar(0, 0, 0), cv::Scalar(255,255, 255)); cv::cvtColor(mat, mat, toCvtColorType(_colorFormat)); blob = img2Blob(mat, _inputLayout); diff --git a/src/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt b/src/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt index cf8b0d02b70..03954891aab 100644 --- a/src/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt +++ b/src/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt @@ -56,18 +56,7 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) # Install rules -# for ieFuncTests install(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION ${OV_CPACK_PLUGINSDIR} COMPONENT tests EXCLUDE_FROM_ALL) - -# for InferenceEngineUnitTest -# For public CI -install(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) -if(NOT WIN32) - # For private CI - install(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) -endif() + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) ov_install_static_lib(${TARGET_NAME} ${OV_CPACK_COMP_CORE}) diff --git a/tests/stress_tests/memcheck_tests/CMakeLists.txt b/tests/stress_tests/memcheck_tests/CMakeLists.txt index ec930460fa7..5193377b38f 100644 --- a/tests/stress_tests/memcheck_tests/CMakeLists.txt +++ b/tests/stress_tests/memcheck_tests/CMakeLists.txt @@ -14,5 +14,5 @@ target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET_NAME} PRIVATE StressTestsCommon) install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) + RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/tests/stress_tests/memleaks_tests/CMakeLists.txt b/tests/stress_tests/memleaks_tests/CMakeLists.txt index 6f02a3faa3b..be49148e0fe 100644 --- a/tests/stress_tests/memleaks_tests/CMakeLists.txt +++ b/tests/stress_tests/memleaks_tests/CMakeLists.txt @@ -13,5 +13,5 @@ add_executable(${TARGET_NAME} ${HDR} ${SRC}) target_link_libraries(${TARGET_NAME} PRIVATE StressTestsCommon) install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) + RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/tests/stress_tests/unittests/CMakeLists.txt b/tests/stress_tests/unittests/CMakeLists.txt index 7a470969ad6..0196713f479 100644 --- a/tests/stress_tests/unittests/CMakeLists.txt +++ b/tests/stress_tests/unittests/CMakeLists.txt @@ -13,4 +13,4 @@ add_executable(${TARGET_NAME} ${HDR} ${SRC}) target_link_libraries(${TARGET_NAME} PRIVATE StressTestsCommon) install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) + RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 04a5027787f..4cf9fcdd194 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -51,7 +51,13 @@ if(ENABLE_SYSTEM_PUGIXML) find_package(PugiXML QUIET) if(PugiXML_FOUND) set_target_properties(pugixml PROPERTIES IMPORTED_GLOBAL ON) - add_library(pugixml::static ALIAS pugixml) + if(TARGET pugixml::static) + # sometimes pugixml::static target already exists, just need to make it global + set_target_properties(pugixml::static PROPERTIES IMPORTED_GLOBAL ON) + else() + # or create an alias + add_library(pugixml::static ALIAS pugixml) + endif() else() # reset to prevent improper code generation in OpenVINODeveloperPackage set(ENABLE_SYSTEM_PUGIXML OFF CACHE BOOL "" FORCE) diff --git a/tools/legacy/benchmark_app/CMakeLists.txt b/tools/legacy/benchmark_app/CMakeLists.txt index c52363ffb2e..7413928c8a8 100644 --- a/tools/legacy/benchmark_app/CMakeLists.txt +++ b/tools/legacy/benchmark_app/CMakeLists.txt @@ -29,7 +29,7 @@ endif() target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime format_reader gflags) -find_package(OpenCV COMPONENTS core QUIET) +find_package(OpenCV QUIET COMPONENTS core) if(NOT OpenCV_FOUND) message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support. Set OpenCV_DIR") else() diff --git a/tools/mo/CMakeLists.txt b/tools/mo/CMakeLists.txt index b32ceb22a67..0cfb7d610bd 100644 --- a/tools/mo/CMakeLists.txt +++ b/tools/mo/CMakeLists.txt @@ -19,22 +19,24 @@ endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/automation/version.txt.in" "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" @ONLY) -install(FILES requirements_dev.txt - DESTINATION tests/mo - COMPONENT tests - EXCLUDE_FROM_ALL) +if(ENABLE_TESTS) + install(FILES requirements_dev.txt + DESTINATION tests/mo + COMPONENT tests + EXCLUDE_FROM_ALL) -install(DIRECTORY unit_tests - DESTINATION tests/mo - COMPONENT tests - EXCLUDE_FROM_ALL) + install(DIRECTORY unit_tests + DESTINATION tests/mo + COMPONENT tests + EXCLUDE_FROM_ALL) -install(DIRECTORY automation - DESTINATION tests/mo - COMPONENT tests - EXCLUDE_FROM_ALL) + install(DIRECTORY automation + DESTINATION tests/mo + COMPONENT tests + EXCLUDE_FROM_ALL) -install(FILES .coveragerc - DESTINATION tests/mo - COMPONENT tests - EXCLUDE_FROM_ALL) + install(FILES .coveragerc + DESTINATION tests/mo + COMPONENT tests + EXCLUDE_FROM_ALL) +endif()