Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[coverity, core] Fix high IE common issues 25.4 (#32441)

Pawel Raasz8080e26288cd
diff --git a/.github/workflows/windows_vs2022_debug.yml b/.github/workflows/windows_vs2022_debug.yml
index 8e7aafc9333..a7b7d2c3913 100644
--- a/.github/workflows/windows_vs2022_debug.yml
+++ b/.github/workflows/windows_vs2022_debug.yml
@@ -48,7 +48,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*'
-
+
- name: Get target branch
id: set_target_branch
run: |
@@ -81,8 +81,8 @@ jobs:
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
os: 'windows_2022'
build-type: 'Debug'
- timeout-minutes: 60
-
+ timeout-minutes: 90
+
Overall_Status:
name: ci/gha_overall_status_windows_debug
needs: [ Smart_CI, Build, CXX_Unit_Tests ]
diff --git a/src/core/src/runtime/allocator.cpp b/src/core/src/runtime/allocator.cpp
index b119ad48822..0676e9ab58f 100644
--- a/src/core/src/runtime/allocator.cpp
+++ b/src/core/src/runtime/allocator.cpp
@@ -86,7 +86,7 @@ bool Allocator::operator==(const Allocator& other) const {
if (_impl == other._impl) {
return true;
}
- return _impl->is_equal(*other._impl);
+ return other._impl && _impl->is_equal(*other._impl);
});
}
diff --git a/src/core/tests/ov_default_allocator_test.cpp b/src/core/tests/ov_default_allocator_test.cpp
index 81fa65186ff..bd5a8f6cdc4 100644
--- a/src/core/tests/ov_default_allocator_test.cpp
+++ b/src/core/tests/ov_default_allocator_test.cpp
@@ -10,6 +10,8 @@
#include "openvino/core/except.hpp"
#include "openvino/runtime/allocator.hpp"
+namespace ov::test {
+using ::testing::_;
using OVDefaultAllocatorTest = ::testing::Test;
TEST_F(OVDefaultAllocatorTest, notThrowOnZeroSize) {
@@ -59,3 +61,12 @@ TEST_F(OVDefaultAllocatorTest, canAllocate10KMemory) {
EXPECT_EQ(ptr[9999], 11);
allocator.deallocate(handle);
}
+
+TEST_F(OVDefaultAllocatorTest, compareIfImplIsNull) {
+ auto a1 = ov::Allocator();
+ auto a2 = std::move(a1);
+
+ EXPECT_FALSE(a2 == a1);
+ OV_EXPECT_THROW(std::ignore = (a1 == a2), ov::Exception, _);
+}
+} // namespace ov::test
diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp
index 4062187fd2e..e561d6d47a8 100644
--- a/src/inference/src/dev/core_impl.cpp
+++ b/src/inference/src/dev/core_impl.cpp
@@ -783,11 +783,16 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
// here we can store values like GPU.0, GPU.1 and we need to set properties to plugin
// for each such .0, .1, .# device to make sure plugin can handle different settings for different
// device IDs
- for (auto pluginDesc : pluginRegistry) {
- ov::DeviceIDParser parser(pluginDesc.first);
- if (pluginDesc.first.find(deviceName) != std::string::npos && !parser.get_device_id().empty()) {
- pluginDesc.second.defaultConfig[deviceKey] = parser.get_device_id();
- plugin.set_property(pluginDesc.second.defaultConfig);
+ {
+ std::unique_lock<std::mutex> g_lock(get_mutex());
+ for (auto pluginDesc : pluginRegistry) {
+ ov::DeviceIDParser parser(pluginDesc.first);
+ if (pluginDesc.first.find(deviceName) != std::string::npos &&
+ !parser.get_device_id().empty()) {
+ g_lock.unlock();
+ pluginDesc.second.defaultConfig[deviceKey] = parser.get_device_id();
+ plugin.set_property(pluginDesc.second.defaultConfig);
+ }
}
}
}
diff --git a/src/inference/src/dev/plugin.cpp b/src/inference/src/dev/plugin.cpp
index 0bc133d153f..9d771870979 100644
--- a/src/inference/src/dev/plugin.cpp
+++ b/src/inference/src/dev/plugin.cpp
@@ -45,7 +45,7 @@ const ov::Version ov::Plugin::get_version() const {
}
void ov::Plugin::set_property(const ov::AnyMap& config) {
- m_ptr->set_property(config);
+ OV_PLUGIN_CALL_STATEMENT(m_ptr->set_property(config));
}
ov::SoPtr<ov::ICompiledModel> ov::Plugin::compile_model(const std::shared_ptr<const ov::Model>& model,
@@ -108,7 +108,7 @@ ov::SoPtr<ov::IRemoteContext> ov::Plugin::get_default_context(const AnyMap& para
}
ov::Any ov::Plugin::get_property(const std::string& name, const AnyMap& arguments) const {
- return {m_ptr->get_property(name, arguments), {m_so}};
+ OV_PLUGIN_CALL_STATEMENT(return {m_ptr->get_property(name, arguments), {m_so}});
}
bool ov::Plugin::supports_model_caching(const ov::AnyMap& arguments) const {
diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp
index d474ee3bf86..1e5ab296e43 100644
--- a/src/inference/tests/functional/caching_test.cpp
+++ b/src/inference/tests/functional/caching_test.cpp
@@ -444,9 +444,7 @@ private:
return res;
}));
- EXPECT_CALL(plugin, set_property(_)).Times(AnyNumber()).WillRepeatedly(Invoke([](const ov::AnyMap&) {
- OPENVINO_NOT_IMPLEMENTED;
- }));
+ EXPECT_CALL(plugin, set_property(_)).Times(AnyNumber());
}
};
diff --git a/src/inference/tests/functional/ov_core_threading.cpp b/src/inference/tests/functional/ov_core_threading.cpp
index ef7eedf65f0..9d4ebe3efed 100644
--- a/src/inference/tests/functional/ov_core_threading.cpp
+++ b/src/inference/tests/functional/ov_core_threading.cpp
@@ -90,11 +90,11 @@ TEST_F(CoreThreadingTests, SetConfigPluginDoesNotExist) {
TEST_F(CoreThreadingTests, RegisterPlugin) {
ov::Core core;
std::atomic<int> index{0};
- auto plugin_path = ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(),
- std::string("mock_engine") + OV_BUILD_POSTFIX);
+ const auto plugin_path = ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(),
+ std::string("mock_engine") + OV_BUILD_POSTFIX);
runParallel(
[&]() {
- const std::string deviceName = std::to_string(index++);
+ const auto deviceName = std::to_string(index++);
core.register_plugin(plugin_path, deviceName);
core.get_versions(deviceName);
core.unload_plugin(deviceName);
@@ -110,12 +110,12 @@ TEST_F(CoreThreadingTests, RegisterPlugins) {
# endif
ov::Core core;
std::atomic<unsigned int> index{0};
- auto file_prefix = ov::test::utils::generateTestFilePrefix();
- auto plugin_path = ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(),
- std::string("mock_engine") + OV_BUILD_POSTFIX);
+ const auto file_prefix = ov::test::utils::generateTestFilePrefix();
+ const auto plugin_path = ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(),
+ std::string("mock_engine") + OV_BUILD_POSTFIX);
auto getPluginXml = [&]() -> std::tuple<std::filesystem::path, std::string> {
- std::string indexStr = std::to_string(index++);
+ const auto indexStr = std::to_string(index++);
std::filesystem::path pluginsXML = file_prefix + indexStr + ".xml";
std::ofstream file(pluginsXML);
@@ -127,7 +127,7 @@ TEST_F(CoreThreadingTests, RegisterPlugins) {
file.flush();
file.close();
- return std::tie(pluginsXML, indexStr);
+ return std::make_tuple(pluginsXML, indexStr);
};
runParallel(
diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp
index 8704e8cdb32..247cd4bbe29 100644
--- a/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp
+++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp
@@ -212,7 +212,6 @@ class MockPlugin : public ov::IPlugin {
if (it.first == ov::num_streams.name())
num_streams = it.second.as<ov::streams::Num>();
}
- OPENVINO_NOT_IMPLEMENTED;
}
ov::Any get_property(const std::string& name, const ov::AnyMap& arguments) const override {
diff --git a/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp b/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp
index fa27397156f..a419dc78630 100644
--- a/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp
+++ b/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp
@@ -19,7 +19,7 @@
class MockInternalPlugin : public ov::IPlugin {
ov::IPlugin* m_plugin = nullptr;
- ov::AnyMap config;
+ ov::AnyMap config{};
public:
explicit MockInternalPlugin(ov::IPlugin* target) : m_plugin(target) {}
@@ -57,7 +57,7 @@ public:
ov::Any get_property(const std::string& name, const ov::AnyMap& arguments) const override {
if (m_plugin)
return m_plugin->get_property(name, arguments);
- OPENVINO_NOT_IMPLEMENTED;
+ return "";
}
ov::SoPtr<ov::IRemoteContext> create_context(const ov::AnyMap& remote_properties) const override {