diff --git a/src/bindings/c/tests/ie_c_api_test.cpp b/src/bindings/c/tests/ie_c_api_test.cpp index 9a0f24c98667b9..948a02e533f698 100644 --- a/src/bindings/c/tests/ie_c_api_test.cpp +++ b/src/bindings/c/tests/ie_c_api_test.cpp @@ -127,21 +127,11 @@ TEST(ie_core_register_plugin, registerPlugin) { IE_ASSERT_OK(ie_core_create("", &core)); ASSERT_NE(nullptr, core); - ie_network_t *network = nullptr; - IE_EXPECT_OK(ie_core_read_network(core, xml, bin, &network)); - EXPECT_NE(nullptr, network); - - const char *plugin_name = "openvino_intel_cpu_plugin"; + const char *plugin_name = "test_plugin"; const char *device_name = "BLA"; IE_EXPECT_OK(ie_core_register_plugin(core, plugin_name, device_name)); - ie_config_t config = {nullptr, nullptr, nullptr}; - ie_executable_network_t *exe_network = nullptr; - IE_EXPECT_OK(ie_core_load_network(core, network, device_name, &config, &exe_network)); - EXPECT_NE(nullptr, exe_network); - - ie_exec_network_free(&exe_network); - ie_network_free(&network); + // TODO: add check "BLA" is in core->object.get_registered_devices() ie_core_free(&core); } @@ -150,43 +140,25 @@ TEST(ie_core_register_plugins, registerPlugins) { IE_ASSERT_OK(ie_core_create("", &core)); ASSERT_NE(nullptr, core); - ie_network_t *network = nullptr; - IE_EXPECT_OK(ie_core_read_network(core, xml, bin, &network)); - EXPECT_NE(nullptr, network); - IE_EXPECT_OK(ie_core_register_plugins(core, plugins_xml)); - ie_config_t config = {nullptr, nullptr, nullptr}; - const char *device_name = "CUSTOM"; - ie_executable_network_t *exe_network = nullptr; - IE_EXPECT_OK(ie_core_load_network(core, network, device_name, &config, &exe_network)); - EXPECT_NE(nullptr, exe_network); - - ie_exec_network_free(&exe_network); - ie_network_free(&network); + // TODO: add check "CUSTOM" is in core->object.get_registered_devices() ie_core_free(&core); } -TEST(ie_core_unregister_plugin, unregisterPlugin) { +TEST(ie_core_unload_plugin, unloadPlugin) { ie_core_t *core = nullptr; - IE_ASSERT_OK(ie_core_create(plugins_xml, &core)); + IE_ASSERT_OK(ie_core_create("", &core)); ASSERT_NE(nullptr, core); - ie_network_t *network = nullptr; - IE_EXPECT_OK(ie_core_read_network(core, xml, bin, &network)); - EXPECT_NE(nullptr, network); - - ie_config_t config = {nullptr, nullptr, nullptr}; - const char *device_name = "CUSTOM"; - ie_executable_network_t *exe_network = nullptr; - IE_EXPECT_OK(ie_core_load_network(core, network, device_name, &config, &exe_network)); - EXPECT_NE(nullptr, exe_network); - - ie_exec_network_free(&exe_network); - ie_network_free(&network); - + const char *device_name = "CPU"; + ie_core_versions_t versions = {0}; + // Trigger plugin loading + IE_EXPECT_OK(ie_core_get_versions(core, device_name, &versions)); + // Unload plugin IE_EXPECT_OK(ie_core_unregister_plugin(core, device_name)); + ie_core_versions_free(&versions); ie_core_free(&core); } diff --git a/src/bindings/python/tests/test_runtime/test_core.py b/src/bindings/python/tests/test_runtime/test_core.py index 3233cb1422f414..670b633691b684 100644 --- a/src/bindings/python/tests/test_runtime/test_core.py +++ b/src/bindings/python/tests/test_runtime/test_core.py @@ -262,9 +262,7 @@ def test_register_plugin(device): full_device_name = core.get_property(device, "FULL_DEVICE_NAME") lib_name = generate_lib_name(device, full_device_name) core.register_plugin(lib_name, "BLA") - model = core.read_model(model=test_net_xml, weights=test_net_bin) - compiled_model = core.compile_model(model, "BLA") - assert isinstance(compiled_model, CompiledModel), "Cannot load the network to the registered plugin with name 'BLA'" + # TODO: add check "BLA" is in core.get_registered_devices() @pytest.mark.dynamic_library() @@ -273,27 +271,15 @@ def test_register_plugins(device): full_device_name = core.get_property(device, "FULL_DEVICE_NAME") plugins_xml = plugins_path(device, full_device_name) core.register_plugins(plugins_xml) - model = core.read_model(model=test_net_xml, weights=test_net_bin) - compiled_model = core.compile_model(model, "CUSTOM") - os.remove(plugins_xml) - assert isinstance(compiled_model, CompiledModel), ( - "Cannot load the network to " - "the registered plugin with name 'CUSTOM' " - "registered in the XML file" - ) + # TODO: add check "CUSTOM" is in core.get_registered_devices() -@pytest.mark.skip(reason="Need to figure out if it's expected behaviour (fails with C++ API as well") -def test_unregister_plugin(device): +def test_unload_plugin(device): core = Core() + # Trigger plugin loading + core.get_versions(device) + # Unload plugin core.unload_plugin(device) - model = core.read_model(model=test_net_xml, weights=test_net_bin) - with pytest.raises(RuntimeError) as e: - core.load_network(model, device) - assert ( - f"Device with '{device}' name is not registered in the OpenVINO Runtime" - in str(e.value) - ) @pytest.mark.template_plugin() diff --git a/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py b/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py index b0449985e914e5..0afc33fdcfa98c 100644 --- a/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py +++ b/src/bindings/python/tests_compatibility/test_inference_engine/test_IECore.py @@ -85,45 +85,29 @@ def test_query_network(device): @pytest.mark.dynamic_library -@pytest.mark.skipif(os.environ.get("TEST_DEVICE", "CPU") != "CPU", reason="Device dependent test") def test_register_plugin(): ie = IECore() - if ie.get_metric("CPU", "FULL_DEVICE_NAME") == "arm_compute::NEON": - pytest.skip("Can't run on ARM plugin due-to openvino_intel_cpu_plugin specific test") ie.register_plugin("openvino_intel_cpu_plugin", "BLA") - net = ie.read_network(model=test_net_xml, weights=test_net_bin) - exec_net = ie.load_network(net, "BLA") - assert isinstance(exec_net, ExecutableNetwork), "Cannot load the network to the registered plugin with name 'BLA'" - + # TODO: add check "BLA" is in core.get_registered_devices() @pytest.mark.dynamic_library -@pytest.mark.skipif(os.environ.get("TEST_DEVICE", "CPU") != "CPU", reason="Device dependent test") def test_register_plugins(): ie = IECore() - if ie.get_metric("CPU", "FULL_DEVICE_NAME") == "arm_compute::NEON": - pytest.skip("Can't run on ARM plugin due-to openvino_intel_cpu_plugin specific test") if platform == "linux" or platform == "linux2": ie.register_plugins(plugins_xml) elif platform == "darwin": ie.register_plugins(plugins_osx_xml) elif platform == "win32": ie.register_plugins(plugins_win_xml) - - net = ie.read_network(model=test_net_xml, weights=test_net_bin) - exec_net = ie.load_network(net, "CUSTOM") - assert isinstance(exec_net, - ExecutableNetwork), "Cannot load the network to the registered plugin with name 'CUSTOM' " \ - "registred in the XML file" + # TODO: add check "CUSTOM" is in core.get_registered_devices() -@pytest.mark.skip(reason="Need to figure out if it's expected behaviour (fails with C++ API as well") -def test_unregister_plugin(device): +def test_unload_plugin(device): ie = IECore() + # Trigger plugin loading + ie.get_versions(device) + # Unload plugin ie.unregister_plugin(device) - net = ie.read_network(model=test_net_xml, weights=test_net_bin) - with pytest.raises(RuntimeError) as e: - ie.load_network(net, device) - assert f"Device with '{device}' name is not registered in the OpenVINO Runtime" in str(e.value) def test_available_devices(device):