Skip to content

Commit aac2387

Browse files
RyanMetcalfeInt8jatinwadhwa921
authored andcommitted
Add PluginEp_CheckV2DisallowedProviderOptions test
1 parent e6daded commit aac2387

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

onnxruntime/test/providers/openvino/openvino_plugin.cc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@ TEST_F(OrtEpLibraryOv, MetaDevicesAvailable) {
137137
}
138138
}
139139

140+
TEST_F(OrtEpLibraryOv, RunSessionWithAllAUTODevices) {
141+
auto ep_devices = ort_env->GetEpDevices();
142+
std::vector<Ort::ConstEpDevice> matching_devices;
143+
144+
for (const auto& device : ep_devices) {
145+
std::string ep_name = device.EpName();
146+
if (ep_name.find(registration_name) != std::string::npos &&
147+
(ep_name == registration_name + ".AUTO")) {
148+
matching_devices.push_back(device);
149+
}
150+
}
151+
Ort::SessionOptions session_options;
152+
session_options.AppendExecutionProvider_V2(*ort_env, matching_devices, std::unordered_map<std::string, std::string>{});
153+
Ort::Session session(*ort_env, ORT_TSTR("testdata/mul_1.onnx"), session_options);
154+
}
155+
140156
TEST_F(OrtEpLibraryOv, PluginEp_AppendV2_MulInference) {
141157
auto plugin_ep_device = GetOvCpuEpDevice();
142158
ASSERT_NE(plugin_ep_device, nullptr);
@@ -178,6 +194,31 @@ TEST_F(OrtEpLibraryOv, PluginEp_AppendV2_cpu_epctx_variants) {
178194
}
179195
}
180196

197+
TEST_F(OrtEpLibraryOv, PluginEp_CheckV2DisallowedProviderOptions) {
198+
auto plugin_ep_device = GetOvCpuEpDevice();
199+
ASSERT_NE(plugin_ep_device, nullptr);
200+
std::vector<std::unordered_map<std::string, std::string>> disallowed_provider_option_examples = {
201+
{{"device_type", "CPU"}},
202+
{{"device_id", "CPU"}},
203+
{{"device_luid", "1234"}},
204+
{{"cache_dir", "cache"}},
205+
{{"precision", "F32"}},
206+
{{"context", "4"}},
207+
{{"num_of_threads", "1"}},
208+
{{"model_priority", "DEFAULT"}},
209+
{{"num_streams", "1"}},
210+
{{"enable_opencl_throttling", "true"}},
211+
{{"enable_qdq_optimizer", "true"}},
212+
{{"disable_dynamic_shapes", "true"}},
213+
};
214+
for (auto& example : disallowed_provider_option_examples) {
215+
EXPECT_THROW({
216+
Ort::SessionOptions session_options;
217+
session_options.AppendExecutionProvider_V2(*ort_env, std::vector<Ort::ConstEpDevice>{plugin_ep_device}, example);
218+
Ort::Session session(*ort_env, ORT_TSTR("testdata/mul_1.onnx"), session_options); }, Ort::Exception);
219+
}
220+
}
221+
181222
TEST_F(OrtEpLibraryOv, GenerateEpContextEmbedded) {
182223
GenerateEpContextOnPluginPath(ORT_TSTR("mul_1_ctx_cpu_embed1.onnx"), true);
183224
}

0 commit comments

Comments
 (0)