forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check extension name and add test cases
- Loading branch information
1 parent
816e99a
commit dc775af
Showing
2 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <fstream> | ||
|
||
#include "common_test_utils/common_utils.hpp" | ||
#include "common_test_utils/file_utils.hpp" | ||
#include "openvino/runtime/core.hpp" | ||
#include "openvino/util/file_util.hpp" | ||
|
||
#ifndef OPENVINO_STATIC_LIBRARY | ||
|
||
static void create_plugin_xml(const std::string& file_name) { | ||
std::ofstream file(file_name); | ||
|
||
file << "<ie><plugins><plugin location=\""; | ||
file << ov::test::utils::getExecutableDirectory(); | ||
file << ov::util::FileTraits<char>::file_separator; | ||
file << ov::util::FileTraits<char>::library_prefix(); | ||
file << "mock_engine"; | ||
file << OV_BUILD_POSTFIX; | ||
file << ov::util::FileTraits<char>::dot_symbol; | ||
file << ov::util::FileTraits<char>::library_ext(); | ||
file << "\" name=\"1\"></plugin></plugins></ie>"; | ||
file.flush(); | ||
file.close(); | ||
} | ||
|
||
static void remove_plugin_xml(const std::string& file_name) { | ||
ov::test::utils::removeFile(file_name); | ||
} | ||
|
||
TEST(CoreBaseTest, LoadPluginXML) { | ||
std::string xml_file_name = "test_plugin.xml"; | ||
std::string xml_file_path = | ||
ov::test::utils::getOpenvinoLibDirectory() + 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); | ||
} | ||
|
||
TEST(CoreBaseTest, LoadPluginInvalidXML) { | ||
std::string xml_file_name = "test_plugin.test"; | ||
std::string xml_file_path = | ||
ov::test::utils::getOpenvinoLibDirectory() + ov::util::FileTraits<char>::file_separator + xml_file_name; | ||
create_plugin_xml(xml_file_path); | ||
EXPECT_ANY_THROW(ov::Core core(xml_file_name)); | ||
remove_plugin_xml(xml_file_path); | ||
} | ||
|
||
TEST(CoreBaseTest, LoadAbsolutePathPluginXML) { | ||
std::string xml_file_name = "test_plugin.xml"; | ||
std::string xml_file_path = | ||
ov::test::utils::getCurrentWorkingDir() + 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); | ||
} | ||
|
||
#endif |