[IE TESTS] MOVE plugin tests (#659)
authorIrina Efode <irina.efode@intel.com>
Thu, 28 May 2020 14:22:19 +0000 (17:22 +0300)
committerGitHub <noreply@github.com>
Thu, 28 May 2020 14:22:19 +0000 (17:22 +0300)
inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt
inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/CMakeLists.txt [moved from inference-engine/tests_deprecated/mock_engine/CMakeLists.txt with 100% similarity]
inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/dllmain.cpp [moved from inference-engine/tests_deprecated/mock_engine/dllmain.cpp with 100% similarity]
inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp [moved from inference-engine/tests_deprecated/mock_engine/mock_plugin.cpp with 100% similarity]
inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.hpp [moved from inference-engine/tests_deprecated/mock_engine/mock_plugin.hpp with 100% similarity]
inference-engine/tests/unit/inference_engine/CMakeLists.txt
inference-engine/tests/unit/inference_engine/cpp_interfaces/ie_plugin_test.cpp
inference-engine/tests/unit/inference_engine/ie_plugin_ptr.cpp [moved from inference-engine/tests_deprecated/unit/inference_engine_tests/inference_engine_plugin_test.cpp with 78% similarity]
inference-engine/tests_deprecated/CMakeLists.txt

index 91076ff..df611c7 100644 (file)
@@ -4,6 +4,8 @@
 
 set(TARGET_NAME unitTestUtils)
 
+add_subdirectory(mocks/mock_engine)
+
 list(APPEND EXPORT_DEPENDENCIES
         commonTestUtils_s
         inference_engine_s
index 629a2ce..3eb21a4 100644 (file)
@@ -10,6 +10,8 @@ addIeTargetTest(
         LINK_LIBRARIES
             unitTestUtils
         ADD_CPPLINT
+        DEPENDENCIES
+            mock_engine
         LABELS
             IE
-)
\ No newline at end of file
+)
index 5e6224a..de0097b 100644 (file)
@@ -13,7 +13,6 @@
 #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp"
 #include "unit_test_utils/mocks/cpp_interfaces/impl/mock_executable_thread_safe_default.hpp"
 #include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinfer_request_internal.hpp"
-#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
 
 using namespace ::testing;
 using namespace std;
@@ -163,3 +162,4 @@ TEST_F(InferenceEnginePluginInternalTest, pluginInternalEraseMagicAndNameWhenImp
     ASSERT_EQ(mockExeNetworkInternal->exportString, mock_plugin_impl->importedString);
     mock_plugin_impl->importedString = {};
 }
+
@@ -2,12 +2,11 @@
 // SPDX-License-Identifier: Apache-2.0
 //
 
-#include "tests_common.hpp"
-
 #include <ie_plugin_ptr.hpp>
+#include <common_test_utils/test_constants.hpp>
 #include "details/ie_so_loader.h"
 
-#include "../tests_deprecated/mock_engine/mock_plugin.hpp"
+#include "unit_test_utils/mocks/mock_engine/mock_plugin.hpp"
 #include "unit_test_utils/mocks/mock_error_listener.hpp"
 #include "unit_test_utils/mocks/mock_iinference_plugin.hpp"
 
@@ -19,20 +18,25 @@ using namespace InferenceEngine::details;
 
 IE_SUPPRESS_DEPRECATED_START
 
-class PluginTest: public TestsCommon {
+class PluginTest: public ::testing::Test {
 protected:
     unique_ptr<SharedObjectLoader> sharedObjectLoader;
     std::function<IInferencePlugin*(IInferencePlugin*)> createPluginEngineProxy;
-    InferenceEnginePluginPtr getPtr() ;
-    virtual void SetUp() {
+    InferenceEnginePluginPtr getPtr();
+
+    std::string get_mock_engine_name() {
+        std::string mockEngineName("mock_engine");
+        return CommonTestUtils::pre + mockEngineName + IE_BUILD_POSTFIX + CommonTestUtils::ext;
+    }
 
+    virtual void SetUp() {
         std::string libraryName = get_mock_engine_name();
         sharedObjectLoader.reset(new SharedObjectLoader(libraryName.c_str()));
         createPluginEngineProxy = make_std_function<IInferencePlugin*(IInferencePlugin*)>("CreatePluginEngineProxy");
     }
     template <class T>
     std::function<T> make_std_function(const std::string& functionName) {
-        std::function <T> ptr (reinterpret_cast<T*>(sharedObjectLoader->get_symbol(functionName.c_str())));
+        std::function <T> ptr(reinterpret_cast<T*>(sharedObjectLoader->get_symbol(functionName.c_str())));
         return ptr;
     }
 
@@ -43,7 +47,7 @@ protected:
 TEST_F(PluginTest, canCreatePlugin) {
     auto ptr = make_std_function<IInferencePlugin*(IInferencePlugin*)>("CreatePluginEngineProxy");
 
-    unique_ptr<IInferencePlugin, std::function<void (IInferencePlugin*)>> smart_ptr(ptr(nullptr), [](IInferencePlugin *p) {
+    unique_ptr<IInferencePlugin, std::function<void(IInferencePlugin*)>> smart_ptr(ptr(nullptr), [](IInferencePlugin *p) {
         p->Release();
     });
 
@@ -62,8 +66,7 @@ TEST_F(PluginTest, shouldThrowExceptionIfPluginNotExist) {
 
 ACTION_TEMPLATE(CallListenerWithErrorMessage,
                 HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_1_VALUE_PARAMS(pointer))
-{
+                AND_1_VALUE_PARAMS(pointer)) {
     InferenceEngine::IErrorListener & data = ::std::get<k>(args);
     data.onError(pointer);
 }
@@ -71,7 +74,7 @@ ACTION_TEMPLATE(CallListenerWithErrorMessage,
 InferenceEnginePluginPtr PluginTest::getPtr() {
     InferenceEnginePluginPtr smart_ptr(get_mock_engine_name());
     return smart_ptr;
-};
+}
 
 TEST_F(PluginTest, canSetConfiguration) {
     InferenceEnginePluginPtr ptr = getPtr();
@@ -86,3 +89,5 @@ TEST_F(PluginTest, canSetConfiguration) {
 
     ASSERT_STREQ(reinterpret_cast<MockPlugin*>(*ptr)->config["key"].c_str(), "value");
 }
+
+IE_SUPPRESS_DEPRECATED_END
\ No newline at end of file
index 5b3563e..66ad501 100644 (file)
@@ -8,8 +8,6 @@
 
 enable_testing()
 
-add_subdirectory(mock_engine)
-
 add_subdirectory(helpers)
 
 if (ENABLE_GAPI_TESTS)