1
1
// Copyright (C) 2018-2024 Intel Corporation
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
//
4
+ #include " common_test_utils/test_constants.hpp"
4
5
#include " hetero_tests.hpp"
5
6
#include " openvino/runtime/exec_model_info.hpp"
6
7
#include " openvino/runtime/internal_properties.hpp"
@@ -23,45 +24,45 @@ TEST_F(HeteroTests, get_available_devices) {
23
24
24
25
TEST_F (HeteroTests, compile_with_registered_devices) {
25
26
// 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" ));
27
28
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 ));
29
30
}
30
31
31
32
TEST_F (HeteroTests, compile_with_unregistered_devices_throw) {
32
33
// 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" ));
34
35
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);
36
37
}
37
38
38
39
TEST_F (HeteroTests, compile_without_device_priorities_throw) {
39
40
// Change device priority
40
- core.set_property (" HETERO " , ov::device::priorities (" " ));
41
+ core.set_property (ov::test::utils::DEVICE_HETERO , ov::device::priorities (" " ));
41
42
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);
43
44
}
44
45
45
46
TEST_F (HeteroTests, compile_dynamic_model_fail) {
46
47
// 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" ));
48
49
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);
50
51
}
51
52
52
53
TEST_F (HeteroTests, compile_model_shapeof) {
53
54
// 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" ));
55
56
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 ));
57
58
}
58
59
59
60
TEST_F (HeteroTests, compile_with_device_properties) {
60
61
ov::AnyMap config = {ov::device::priorities (" MOCK0,MOCK1" ),
61
62
ov::device::properties (" MOCK0" , ov::num_streams (4 ), ov::enable_profiling (false )),
62
63
ov::device::properties (" MOCK1" , ov::num_streams (6 ), ov::enable_profiling (true ))};
63
64
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);
65
66
EXPECT_THROW (compiled_model.get_property (ov::num_streams), ov::Exception);
66
67
EXPECT_THROW (compiled_model.get_property (ov::enable_profiling), ov::Exception);
67
68
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) {
85
86
ov::device::properties (" MOCK0" , ov::num_streams (4 )),
86
87
ov::device::properties (" MOCK1" , ov::num_streams (6 ))};
87
88
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);
89
90
EXPECT_THROW (compiled_model.get_property (ov::num_streams), ov::Exception);
90
91
auto device_properties = compiled_model.get_property (ov::device::properties.name ()).as <ov::AnyMap>();
91
92
ASSERT_TRUE (device_properties.count (" MOCK0.0" ));
@@ -105,7 +106,7 @@ TEST_F(HeteroTests, get_runtime_model) {
105
106
for (auto & op : model->get_ordered_ops ()) {
106
107
original_names.insert (op->get_friendly_name ());
107
108
}
108
- auto compiled_model = core.compile_model (model, " HETERO " , config);
109
+ auto compiled_model = core.compile_model (model, ov::test::utils::DEVICE_HETERO , config);
109
110
auto runtime_model = compiled_model.get_runtime_model ();
110
111
for (auto & op : runtime_model->get_ordered_ops ()) {
111
112
auto & info = op->get_rt_info ();
0 commit comments