Skip to content

Commit

Permalink
Fix test failures issue due to getting incorrect lib path
Browse files Browse the repository at this point in the history
  • Loading branch information
riverlijunjie committed Feb 19, 2024
1 parent b440b63 commit b5d5642
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/inference/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ std::string find_plugins_xml(const std::string& xml_file) {

// register plugins from default openvino-<openvino version>/plugins.xml config
auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, xml_file_name});
if (ov::util::file_exists(xmlConfigFileDefault))
if (ov::util::file_exists(xmlConfigFileDefault)) {
return xmlConfigFileDefault;
}

// 2. in folder with libopenvino.so
xmlConfigFileDefault = ov::util::path_join({ov_library_path, xml_file_name});
if (ov::util::file_exists(xmlConfigFileDefault))
if (ov::util::file_exists(xmlConfigFileDefault)) {
return xmlConfigFileDefault;
}

return xml_file;
}
Expand Down
10 changes: 6 additions & 4 deletions src/inference/tests/functional/ov_core_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "common_test_utils/common_utils.hpp"
#include "common_test_utils/file_utils.hpp"
#include "file_utils.h"
#include "openvino/runtime/core.hpp"
#include "openvino/util/file_util.hpp"

Expand Down Expand Up @@ -36,7 +37,7 @@ static void remove_plugin_xml(const std::string& file_name) {
TEST(CoreBaseTest, LoadPluginXML) {
std::string xml_file_name = "test_plugin.xml";
std::string xml_file_path =
ov::util::get_ov_lib_path() + ov::util::FileTraits<char>::file_separator + xml_file_name;
InferenceEngine::getIELibraryPath() + ov::util::FileTraits<char>::file_separator + xml_file_name;
create_plugin_xml(xml_file_path);
EXPECT_NO_THROW(ov::Core core(xml_file_name));
remove_plugin_xml(xml_file_path);
Expand All @@ -45,7 +46,7 @@ TEST(CoreBaseTest, LoadPluginXML) {
TEST(CoreBaseTest, LoadPluginDifferentXMLExtension) {
std::string xml_file_name = "test_plugin.test";
std::string xml_file_path =
ov::util::get_ov_lib_path() + ov::util::FileTraits<char>::file_separator + xml_file_name;
InferenceEngine::getIELibraryPath() + ov::util::FileTraits<char>::file_separator + xml_file_name;
create_plugin_xml(xml_file_path);
EXPECT_NO_THROW(ov::Core core(xml_file_name));
remove_plugin_xml(xml_file_path);
Expand All @@ -54,7 +55,7 @@ TEST(CoreBaseTest, LoadPluginDifferentXMLExtension) {
TEST(CoreBaseTest, LoadAbsoluteOVPathPluginXML) {
std::string xml_file_name = "test_plugin.xml";
std::string xml_file_path =
ov::util::get_ov_lib_path() + ov::util::FileTraits<char>::file_separator + xml_file_name;
InferenceEngine::getIELibraryPath() + ov::util::FileTraits<char>::file_separator + xml_file_name;
create_plugin_xml(xml_file_path);
EXPECT_NO_THROW(ov::Core core(xml_file_path));
remove_plugin_xml(xml_file_path);
Expand Down Expand Up @@ -82,7 +83,8 @@ TEST(CoreBaseTest, LoadOVFolderOverCWPathPluginXML) {
std::string xml_file_name = "test_plugin.xml";
std::string cwd_file_path =
ov::test::utils::getCurrentWorkingDir() + ov::util::FileTraits<char>::file_separator + xml_file_name;
std::string ov_file_path = ov::util::get_ov_lib_path() + ov::util::FileTraits<char>::file_separator + xml_file_name;
std::string ov_file_path =
InferenceEngine::getIELibraryPath() + ov::util::FileTraits<char>::file_separator + xml_file_name;
create_plugin_xml(cwd_file_path);
create_plugin_xml(ov_file_path, "2");
ov::Core core(xml_file_name);
Expand Down

0 comments on commit b5d5642

Please sign in to comment.