Skip to content

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

[core] [Properties] Update tests that required WO properties to return non-empty objects (#38825)

Alicja Miloszewskad7af4e2fcb49
diff --git a/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml b/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml
index 068f03cdb23..ce1391011c4 100644
--- a/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml
+++ b/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml
@@ -190,6 +190,14 @@ Example:
</filters>
</skip_config>
+ <!-- C#198014 -->
+ <skip_config>
+ <message>MODEL_PTR is reported as RW but cannot be set outside compiled model import</message>
+ <filters>
+ <filter>.*OVPropertiesDefaultSupportedTests.CanSetDefaultValueBackToPlugin.*</filter>
+ </filters>
+ </skip_config>
+
<!-- E#116575 -->
<skip_config>
<message>NPU fails for `OVIterationChaining.Simple` tests</message>
@@ -318,25 +326,14 @@ Example:
</filters>
</skip_config>
- <!-- C#185847 -->
- <skip_config>
- <message>Write only (WO) properties will return empty ov::Any objects</message>
- <filters>
- <filter>.*OVClassCompiledModelPropertiesTests.canCompileModelWithPropertiesAndCheckGetProperty.*CACHE_ENCRYPTION_CALLBACKS.*</filter>
- <filter>.*OVPropertiesTests.canSetPropertyAndCheckGetProperty.*CACHE_ENCRYPTION_CALLBACKS.*</filter>
- <filter>.*OVPropertiesDefaultSupportedTests.CanSetDefaultValueBackToPlugin.*</filter>
- <filter>.*OVClassCompiledModelGetConfigTest.GetConfigNoThrow.*</filter>
- <filter>.*OVSpecificDeviceGetConfigTest.GetConfigSpecificDeviceNoThrow.*</filter>
- </filters>
- </skip_config>
-
<skip_config>
- <message>UD12 driver does not support CACHE_ENCRYPTION_CALLBACKS on MTL</message>
+ <message>PV driver does not support CACHE_ENCRYPTION_CALLBACKS on MTL</message>
<enable_rules>
<device>3720</device>
- <driver_release>RELEASE</driver_release>
+ <driver_release>PV</driver_release>
</enable_rules>
<filters>
+ <filter>.*OVClassCompiledModelPropertiesTests.canCompileModelWithPropertiesAndCheckGetProperty.*CACHE_ENCRYPTION_CALLBACKS.*</filter>
<filter>.*OVClassCompiledModelPropertiesTests.CanUseCache.*CACHE_ENCRYPTION_CALLBACKS.*</filter>
<filter>.*OVClassCompileModelWithCorrectPropertiesTest.*CACHE_ENCRYPTION_CALLBACKS.*</filter>
<filter>.*OVClassCompiledModelGetPropertyTest.*CACHE_ENCRYPTION_CALLBACKS.*</filter>
diff --git a/src/tests/functional/base_func_tests/src/behavior/compiled_model/properties.cpp b/src/tests/functional/base_func_tests/src/behavior/compiled_model/properties.cpp
index 9ca55296c36..151a853e304 100644
--- a/src/tests/functional/base_func_tests/src/behavior/compiled_model/properties.cpp
+++ b/src/tests/functional/base_func_tests/src/behavior/compiled_model/properties.cpp
@@ -6,6 +6,7 @@
#include <locale.h>
+#include <algorithm>
#include <cstdint>
#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp"
@@ -248,10 +249,14 @@ TEST_P(OVClassCompiledModelPropertiesTests, canCompileModelWithPropertiesAndChec
auto compiled_model = core->compile_model(model, target_device, properties);
auto supported_properties = compiled_model.get_property(ov::supported_properties);
for (const auto& property_item : properties) {
- if (util::contains(supported_properties, property_item.first)) {
+ const auto supported_property =
+ std::find(supported_properties.begin(), supported_properties.end(), property_item.first);
+ if (supported_property != supported_properties.end()) {
Any property;
OV_ASSERT_NO_THROW(property = compiled_model.get_property(property_item.first));
- ASSERT_FALSE(property.empty());
+ if (supported_property->get_mutability() != ov::PropertyMutability::WO) {
+ ASSERT_FALSE(property.empty());
+ }
std::cout << property_item.first << ":" << property.as<std::string>() << std::endl;
}
}
@@ -290,7 +295,7 @@ TEST_P(OVCompiledModelPropertiesDefaultSupportedTests, CanCompileWithDefaultValu
OV_ASSERT_NO_THROW(supported_properties = core->get_property(target_device, ov::supported_properties));
AnyMap default_rw_properties;
for (auto& supported_property : supported_properties) {
- if (supported_property.is_mutable()) {
+ if (supported_property.get_mutability() == ov::PropertyMutability::RW) {
Any property;
OV_ASSERT_NO_THROW(property = core->get_property(target_device, supported_property));
default_rw_properties.emplace(supported_property, property);
@@ -346,7 +351,9 @@ TEST_P(OVClassCompiledModelGetConfigTest, GetConfigNoThrow) {
for (auto&& property : property_names) {
ov::Any defaultValue;
OV_ASSERT_NO_THROW(defaultValue = compiled_model.get_property(property));
- ASSERT_FALSE(defaultValue.empty());
+ if (property.get_mutability() != ov::PropertyMutability::WO) {
+ ASSERT_FALSE(defaultValue.empty());
+ }
}
}
diff --git a/src/tests/functional/base_func_tests/src/behavior/ov_plugin/properties_tests.cpp b/src/tests/functional/base_func_tests/src/behavior/ov_plugin/properties_tests.cpp
index cf371be3f26..0b1c3d17b7d 100644
--- a/src/tests/functional/base_func_tests/src/behavior/ov_plugin/properties_tests.cpp
+++ b/src/tests/functional/base_func_tests/src/behavior/ov_plugin/properties_tests.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
+#include <algorithm>
#include <cstdint>
#include "behavior/ov_plugin/properties_tests.hpp"
@@ -109,9 +110,15 @@ TEST_P(OVPropertiesTests, SetCorrectProperties) {
TEST_P(OVPropertiesTests, canSetPropertyAndCheckGetProperty) {
core->set_property(target_device, properties);
+ const auto supported_properties = core->get_property(target_device, ov::supported_properties);
for (const auto& property_item : properties) {
+ const auto supported_property =
+ std::find(supported_properties.begin(), supported_properties.end(), property_item.first);
Any property;
OV_ASSERT_NO_THROW(property = core->get_property(target_device, property_item.first));
+ if (supported_property != supported_properties.end() && supported_property->get_mutability() == ov::PropertyMutability::WO) {
+ continue;
+ }
ASSERT_FALSE(property.empty());
std::cout << property_item.first << ":" << property.as<std::string>() << std::endl;
}
@@ -164,8 +171,11 @@ TEST_P(OVPropertiesDefaultSupportedTests, CanSetDefaultValueBackToPlugin) {
for (auto& supported_property : supported_properties) {
Any property;
OV_ASSERT_NO_THROW(property = core.get_property(target_device, supported_property));
- ASSERT_FALSE(property.empty());
- if (supported_property.is_mutable()) {
+ if (supported_property.get_mutability() != ov::PropertyMutability::WO) {
+ ASSERT_FALSE(property.empty());
+ }
+ // By definition, write-only properties have no readable value to set back
+ if (supported_property.get_mutability() == ov::PropertyMutability::RW) {
OV_ASSERT_NO_THROW(core.set_property(target_device, {{ supported_property, property}}));
}
}
@@ -662,7 +672,9 @@ TEST_P(OVSpecificDeviceGetConfigTest, GetConfigSpecificDeviceNoThrow) {
for (auto &&confKey : configValues) {
ov::Any defaultValue;
OV_ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, confKey));
- ASSERT_FALSE(defaultValue.empty());
+ if (confKey.get_mutability() != ov::PropertyMutability::WO) {
+ ASSERT_FALSE(defaultValue.empty());
+ }
}
}