-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Support fs::path in register_plugin(s) & Core(xml_file_path) #33043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6e19de7
c614ead
8b4f28e
3514af5
114883a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,17 @@ TEST_F(CoreBaseTest, LoadPluginXML) { | |
| remove_plugin_xml(xml_file_path); | ||
| } | ||
|
|
||
| TEST_F(CoreBaseTest, LoadPluginXMLWithFsPath) { | ||
| std::string xml_file_name = "test_plugin.xml"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not create it as path at start and modify it? |
||
| const auto xml_file_path = std::filesystem::path(ov::test::utils::getOpenvinoLibDirectory() + | ||
| ov::util::FileTraits<char>::file_separator + xml_file_name); | ||
| create_plugin_xml(xml_file_path.string(), "1"); | ||
| ov::Core core(xml_file_path); | ||
| auto versions = core.get_versions("1"); | ||
| EXPECT_FALSE(versions.empty()); | ||
| remove_plugin_xml(xml_file_path.string()); | ||
| } | ||
|
|
||
| TEST_F(CoreBaseTest, LoadPluginDifferentXMLExtension) { | ||
| std::string xml_file_name = "test_plugin.test"; | ||
| std::string xml_file_path = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,6 +184,24 @@ TEST(RegisterPluginTests, registerNewPluginNoThrows) { | |
| core.unload_plugin(mock_plugin_name); | ||
| } | ||
|
|
||
| TEST(RegisterPluginTests, registerNewPluginWithFsPathNoThrows) { | ||
| ov::Core core; | ||
| auto plugin = std::make_shared<ov::test::utils::MockPlugin>(); | ||
| std::shared_ptr<ov::IPlugin> base_plugin = plugin; | ||
| std::shared_ptr<void> m_so; | ||
| mockPlugin(core, base_plugin, m_so); | ||
|
|
||
| std::string mock_plugin_name{"MOCK_HARDWARE_FS"}; | ||
| std::filesystem::path plugin_path = | ||
| ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IS path version called?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How as inputs are strings? |
||
| std::string("mock_engine") + OV_BUILD_POSTFIX); | ||
|
|
||
| OV_ASSERT_NO_THROW(core.register_plugin(plugin_path, mock_plugin_name)); | ||
| OV_ASSERT_NO_THROW(core.get_property(mock_plugin_name, ov::supported_properties)); | ||
|
|
||
| core.unload_plugin(mock_plugin_name); | ||
| } | ||
|
|
||
| TEST(RegisterPluginTests, registerExistingPluginThrows) { | ||
| ov::Core core; | ||
| auto plugin = std::make_shared<ov::test::utils::MockPlugin>(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also consider how path is represented in Python API. In many places it's
Union[str, bytes, pathlib.Path]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can still be like that just mapped as default to use fs::path on C++ side, but it should be recommended to use Path type