Skip to content

Commit c664ca7

Browse files
Clean meta plugin tests from CPU/GPU plugin (openvinotoolkit#24477)
### Details: - Move BATCH related test out from CPU/GPU func test to BATCH func test - Move HETERO related test out from CPU/GPU func test to HETERO func test - *...* ### Tickets: - *ticket-id* --------- Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com> Co-authored-by: Chen Peter <peter.chen@intel.com>
1 parent 59a0f01 commit c664ca7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+525
-491
lines changed

src/plugins/auto_batch/tests/functional/behavior/ov_executable_network/exec_net_base.cpp

+23-14
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@
44

55
#include "behavior/compiled_model/compiled_model_base.hpp"
66

7-
using namespace ov::test::behavior;
8-
namespace {
9-
auto autoBatchConfigs = []() {
10-
return std::vector<ov::AnyMap>{
11-
// explicit batch size 4 to avoid fallback to no auto-batching
12-
{{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"},
13-
// no timeout to avoid increasing the test time
14-
{ov::auto_batch_timeout.name(), "0"}}};
15-
};
7+
namespace ov {
8+
namespace test {
9+
namespace behavior {
10+
auto autoBatchConfigs =
11+
std::vector<ov::AnyMap>{// explicit batch size 4 to avoid fallback to no auto-batching
12+
{{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"},
13+
// no timeout to avoid increasing the test time
14+
{ov::auto_batch_timeout.name(), "0"}}};
1615

17-
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests, OVCompiledModelBaseTest,
18-
::testing::Combine(
19-
::testing::Values(ov::test::utils::DEVICE_BATCH),
20-
::testing::ValuesIn(autoBatchConfigs())),
16+
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests,
17+
OVCompiledModelBaseTest,
18+
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_BATCH),
19+
::testing::ValuesIn(autoBatchConfigs)),
2120
OVCompiledModelBaseTest::getTestCaseName);
2221

23-
} // namespace
22+
std::vector<ov::element::Type> convert_types = {ov::element::f16, ov::element::i64};
23+
24+
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatchBehaviorTests,
25+
CompiledModelSetType,
26+
::testing::Combine(::testing::ValuesIn(convert_types),
27+
::testing::Values(ov::test::utils::DEVICE_BATCH),
28+
::testing::ValuesIn(autoBatchConfigs)),
29+
CompiledModelSetType::getTestCaseName);
30+
} // namespace behavior
31+
} // namespace test
32+
} // namespace ov

src/plugins/auto_batch/tests/functional/behavior/ov_executable_network/properties.cpp

+29-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Copyright (C) 2018-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
4-
54
#include "behavior/compiled_model/properties.hpp"
65

7-
using namespace ov::test::behavior;
6+
#include "behavior/ov_plugin/properties_tests.hpp"
87

9-
namespace {
8+
namespace ov {
9+
namespace test {
10+
namespace behavior {
1011

1112
const std::vector<ov::AnyMap> auto_batch_inproperties = {
1213
{ov::num_streams(-100)},
@@ -33,4 +34,28 @@ INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests,
3334
::testing::ValuesIn(auto_batch_properties)),
3435
OVClassCompiledModelPropertiesTests::getTestCaseName);
3536

36-
} // namespace
37+
INSTANTIATE_TEST_SUITE_P(nightly_OVClassCompiledModelGetPropertyTest,
38+
OVClassCompiledModelGetPropertyTest,
39+
::testing::Values("BATCH:GPU"));
40+
41+
INSTANTIATE_TEST_SUITE_P(nightly_OVClassCompiledModelGetIncorrectPropertyTest,
42+
OVClassCompiledModelGetIncorrectPropertyTest,
43+
::testing::Values("BATCH:GPU"));
44+
45+
const std::vector<ov::AnyMap> batchCorrectConfigs = {{}};
46+
47+
INSTANTIATE_TEST_SUITE_P(nightly_Auto_Batch_OVClassCompileModelWithCorrectPropertiesAutoBatchingTest,
48+
OVClassCompileModelWithCorrectPropertiesTest,
49+
::testing::Combine(::testing::Values("BATCH:GPU"), ::testing::ValuesIn(batchCorrectConfigs)));
50+
51+
const std::vector<std::tuple<std::string, std::pair<ov::AnyMap, std::string>>> GetMetricTest_ExecutionDevice_GPU = {
52+
{"BATCH:GPU", std::make_pair(ov::AnyMap{}, "GPU.0")}};
53+
54+
INSTANTIATE_TEST_SUITE_P(nightly_OVClassCompiledModelGetPropertyTest,
55+
OVClassCompiledModelGetPropertyTest_EXEC_DEVICES,
56+
::testing::ValuesIn(GetMetricTest_ExecutionDevice_GPU));
57+
58+
INSTANTIATE_TEST_SUITE_P(nightly_HeteroAutoBatchOVGetMetricPropsTest, OVGetMetricPropsTest, ::testing::Values("BATCH"));
59+
} // namespace behavior
60+
} // namespace test
61+
} // namespace ov

src/plugins/hetero/tests/functional/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ov_add_test_target(
2020
$<TARGET_PROPERTY:openvino_hetero_plugin,SOURCE_DIR>/src
2121
ADD_CLANG_FORMAT
2222
LABELS
23-
OV UNIT HETERO
23+
OV HETERO
2424
)
2525

2626
target_compile_definitions(${TARGET_NAME} PRIVATE CI_BUILD_NUMBER=\"mock_version\")

src/plugins/hetero/tests/functional/compile_model_tests.cpp

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (C) 2018-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
4+
#include "common_test_utils/test_constants.hpp"
45
#include "hetero_tests.hpp"
56
#include "openvino/runtime/exec_model_info.hpp"
67
#include "openvino/runtime/internal_properties.hpp"
@@ -23,45 +24,45 @@ TEST_F(HeteroTests, get_available_devices) {
2324

2425
TEST_F(HeteroTests, compile_with_registered_devices) {
2526
// Change device priority
26-
core.set_property("HETERO", ov::device::priorities("MOCK0,MOCK1"));
27+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK0,MOCK1"));
2728
auto model = create_model_with_reshape();
28-
EXPECT_NO_THROW(core.compile_model(model, "HETERO"));
29+
EXPECT_NO_THROW(core.compile_model(model, ov::test::utils::DEVICE_HETERO));
2930
}
3031

3132
TEST_F(HeteroTests, compile_with_unregistered_devices_throw) {
3233
// Change device priority
33-
core.set_property("HETERO", ov::device::priorities("MOCK2,MOCK3"));
34+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK2,MOCK3"));
3435
auto model = create_model_with_reshape();
35-
EXPECT_THROW(core.compile_model(model, "HETERO"), ov::Exception);
36+
EXPECT_THROW(core.compile_model(model, ov::test::utils::DEVICE_HETERO), ov::Exception);
3637
}
3738

3839
TEST_F(HeteroTests, compile_without_device_priorities_throw) {
3940
// Change device priority
40-
core.set_property("HETERO", ov::device::priorities(""));
41+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities(""));
4142
auto model = create_model_with_reshape();
42-
EXPECT_THROW(core.compile_model(model, "HETERO"), ov::Exception);
43+
EXPECT_THROW(core.compile_model(model, ov::test::utils::DEVICE_HETERO), ov::Exception);
4344
}
4445

4546
TEST_F(HeteroTests, compile_dynamic_model_fail) {
4647
// Change device priority
47-
core.set_property("HETERO", ov::device::priorities("MOCK0,MOCK1"));
48+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK0,MOCK1"));
4849
auto model = create_model_with_subtract_reshape(true);
49-
EXPECT_THROW(core.compile_model(model, "HETERO"), ov::Exception);
50+
EXPECT_THROW(core.compile_model(model, ov::test::utils::DEVICE_HETERO), ov::Exception);
5051
}
5152

5253
TEST_F(HeteroTests, compile_model_shapeof) {
5354
// Change device priority
54-
core.set_property("HETERO", ov::device::priorities("MOCK0,MOCK1"));
55+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK0,MOCK1"));
5556
auto model = create_model_with_subtract_shapeof_reshape();
56-
EXPECT_NO_THROW(core.compile_model(model, "HETERO"));
57+
EXPECT_NO_THROW(core.compile_model(model, ov::test::utils::DEVICE_HETERO));
5758
}
5859

5960
TEST_F(HeteroTests, compile_with_device_properties) {
6061
ov::AnyMap config = {ov::device::priorities("MOCK0,MOCK1"),
6162
ov::device::properties("MOCK0", ov::num_streams(4), ov::enable_profiling(false)),
6263
ov::device::properties("MOCK1", ov::num_streams(6), ov::enable_profiling(true))};
6364
auto model = create_model_with_subtract_reshape();
64-
auto compiled_model = core.compile_model(model, "HETERO", config);
65+
auto compiled_model = core.compile_model(model, ov::test::utils::DEVICE_HETERO, config);
6566
EXPECT_THROW(compiled_model.get_property(ov::num_streams), ov::Exception);
6667
EXPECT_THROW(compiled_model.get_property(ov::enable_profiling), ov::Exception);
6768
auto device_properties = compiled_model.get_property(ov::device::properties.name()).as<ov::AnyMap>();
@@ -85,7 +86,7 @@ TEST_F(HeteroTests, compile_with_device_properties_no_exclusive) {
8586
ov::device::properties("MOCK0", ov::num_streams(4)),
8687
ov::device::properties("MOCK1", ov::num_streams(6))};
8788
auto model = create_model_with_subtract_reshape();
88-
auto compiled_model = core.compile_model(model, "HETERO", config);
89+
auto compiled_model = core.compile_model(model, ov::test::utils::DEVICE_HETERO, config);
8990
EXPECT_THROW(compiled_model.get_property(ov::num_streams), ov::Exception);
9091
auto device_properties = compiled_model.get_property(ov::device::properties.name()).as<ov::AnyMap>();
9192
ASSERT_TRUE(device_properties.count("MOCK0.0"));
@@ -105,7 +106,7 @@ TEST_F(HeteroTests, get_runtime_model) {
105106
for (auto& op : model->get_ordered_ops()) {
106107
original_names.insert(op->get_friendly_name());
107108
}
108-
auto compiled_model = core.compile_model(model, "HETERO", config);
109+
auto compiled_model = core.compile_model(model, ov::test::utils::DEVICE_HETERO, config);
109110
auto runtime_model = compiled_model.get_runtime_model();
110111
for (auto& op : runtime_model->get_ordered_ops()) {
111112
auto& info = op->get_rt_info();

src/plugins/hetero/tests/functional/import_model_tests.cpp

+13-5
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5+
#include "common_test_utils/test_constants.hpp"
56
#include "hetero_tests.hpp"
67

7-
using namespace ov::hetero::tests;
8+
namespace ov {
9+
namespace hetero {
10+
namespace tests {
811

912
// IR frontend is needed for import
1013
#ifdef IR_FRONTEND_ENABLED
1114
TEST_F(HeteroTests, import_single_plugins) {
1215
std::stringstream model_stream;
1316
auto model = create_model_with_reshape();
1417
{
15-
auto compiled_model = core.compile_model(model, "HETERO", ov::device::priorities("MOCK0"));
18+
auto compiled_model =
19+
core.compile_model(model, ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK0"));
1620
compiled_model.export_model(model_stream);
1721
}
18-
auto compiled_model = core.import_model(model_stream, "HETERO", {});
22+
auto compiled_model = core.import_model(model_stream, ov::test::utils::DEVICE_HETERO, {});
1923
EXPECT_EQ(1, compiled_model.inputs().size());
2024
EXPECT_EQ(1, compiled_model.outputs().size());
2125
auto infer_request = compiled_model.create_infer_request();
@@ -32,10 +36,11 @@ TEST_F(HeteroTests, import_several_plugins) {
3236
std::stringstream model_stream;
3337
auto model = create_model_with_subtract();
3438
{
35-
auto compiled_model = core.compile_model(model, "HETERO", ov::device::priorities("MOCK0,MOCK1"));
39+
auto compiled_model =
40+
core.compile_model(model, ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK0,MOCK1"));
3641
compiled_model.export_model(model_stream);
3742
}
38-
auto compiled_model = core.import_model(model_stream, "HETERO", {});
43+
auto compiled_model = core.import_model(model_stream, ov::test::utils::DEVICE_HETERO, {});
3944
EXPECT_EQ(1, compiled_model.inputs().size());
4045
EXPECT_EQ(1, compiled_model.outputs().size());
4146
auto infer_request = compiled_model.create_infer_request();
@@ -49,3 +54,6 @@ TEST_F(HeteroTests, import_several_plugins) {
4954
EXPECT_EQ(memcmp(input_tensor.data(), output_tensor.data(), input_tensor.get_byte_size()), 0);
5055
}
5156
#endif
57+
} // namespace tests
58+
} // namespace hetero
59+
} // namespace ov
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
// Copyright (C) 2018-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
4+
#include "common_test_utils/test_constants.hpp"
45
#include "hetero_tests.hpp"
56
#include "openvino/runtime/internal_properties.hpp"
67
#include "properties.hpp"
78

8-
using namespace ov::hetero::tests;
9+
namespace ov {
10+
namespace hetero {
11+
namespace tests {
912

1013
TEST_F(HeteroTests, get_property_supported_properties) {
1114
const std::vector<ov::PropertyName> supported_properties = {ov::supported_properties,
1215
ov::device::full_name,
1316
ov::device::capabilities,
1417
ov::device::priorities,
1518
ov::hint::model_distribution_policy};
16-
auto actual_supported_properties = core.get_property("HETERO", ov::supported_properties);
19+
auto actual_supported_properties = core.get_property(ov::test::utils::DEVICE_HETERO, ov::supported_properties);
1720
EXPECT_EQ(supported_properties.size(), actual_supported_properties.size());
1821
for (auto& supported_property : supported_properties) {
1922
ASSERT_TRUE(std::find(actual_supported_properties.begin(),
@@ -24,7 +27,8 @@ TEST_F(HeteroTests, get_property_supported_properties) {
2427

2528
TEST_F(HeteroTests, get_property_internal_supported_properties) {
2629
const std::vector<ov::PropertyName> supported_properties = {ov::internal::caching_properties};
27-
auto actual_supported_properties = core.get_property("HETERO", ov::internal::supported_properties);
30+
auto actual_supported_properties =
31+
core.get_property(ov::test::utils::DEVICE_HETERO, ov::internal::supported_properties);
2832
EXPECT_EQ(supported_properties.size(), actual_supported_properties.size());
2933
for (auto& supported_property : supported_properties) {
3034
ASSERT_TRUE(std::find(actual_supported_properties.begin(),
@@ -34,28 +38,33 @@ TEST_F(HeteroTests, get_property_internal_supported_properties) {
3438
}
3539

3640
TEST_F(HeteroTests, get_property_ro_properties) {
37-
EXPECT_EQ("HETERO", core.get_property("HETERO", ov::device::full_name));
41+
EXPECT_EQ(ov::test::utils::DEVICE_HETERO, core.get_property(ov::test::utils::DEVICE_HETERO, ov::device::full_name));
3842
EXPECT_EQ(std::vector<std::string>{ov::device::capability::EXPORT_IMPORT},
39-
core.get_property("HETERO", ov::device::capabilities));
43+
core.get_property(ov::test::utils::DEVICE_HETERO, ov::device::capabilities));
4044
}
4145

4246
TEST_F(HeteroTests, set_property_device_priorities) {
43-
EXPECT_EQ("", core.get_property("HETERO", ov::device::priorities));
44-
core.set_property("HETERO", ov::device::priorities("MOCK0,MOCK1"));
45-
EXPECT_EQ("MOCK0,MOCK1", core.get_property("HETERO", ov::device::priorities));
47+
EXPECT_EQ("", core.get_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities));
48+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities("MOCK0,MOCK1"));
49+
EXPECT_EQ("MOCK0,MOCK1", core.get_property(ov::test::utils::DEVICE_HETERO, ov::device::priorities));
4650
}
4751

4852
TEST_F(HeteroTests, set_property_ModelDistributionPolicy) {
4953
std::set<ov::hint::ModelDistributionPolicy> value = {};
5054
std::set<ov::hint::ModelDistributionPolicy> model_policy = {ov::hint::ModelDistributionPolicy::PIPELINE_PARALLEL};
5155

52-
OV_ASSERT_NO_THROW(core.set_property("HETERO", ov::hint::model_distribution_policy(model_policy)));
53-
OV_ASSERT_NO_THROW(value = core.get_property("HETERO", ov::hint::model_distribution_policy));
56+
ASSERT_NO_THROW(
57+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::hint::model_distribution_policy(model_policy)));
58+
ASSERT_NO_THROW(value = core.get_property(ov::test::utils::DEVICE_HETERO, ov::hint::model_distribution_policy));
5459
ASSERT_EQ(model_policy, value);
5560

5661
model_policy = {};
5762

58-
OV_ASSERT_NO_THROW(core.set_property("HETERO", ov::hint::model_distribution_policy(model_policy)));
59-
OV_ASSERT_NO_THROW(value = core.get_property("HETERO", ov::hint::model_distribution_policy));
63+
ASSERT_NO_THROW(
64+
core.set_property(ov::test::utils::DEVICE_HETERO, ov::hint::model_distribution_policy(model_policy)));
65+
ASSERT_NO_THROW(value = core.get_property(ov::test::utils::DEVICE_HETERO, ov::hint::model_distribution_policy));
6066
ASSERT_EQ(model_policy, value);
61-
}
67+
}
68+
} // namespace tests
69+
} // namespace hetero
70+
} // namespace ov

0 commit comments

Comments
 (0)