Skip to content

Commit

Permalink
Add test instantiations for template plugin (openvinotoolkit#22627)
Browse files Browse the repository at this point in the history
### Details:
 - Add test instantiations for template plugin

### Tickets:
 - [CVS-130342](https://jira.devtools.intel.com/browse/CVS-130342)
  • Loading branch information
olpipi authored Feb 5, 2024
1 parent d975257 commit abc2899
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "behavior/ov_infer_request/memory_states.hpp"

namespace {
using ov::test::behavior::memoryStateParams;
using ov::test::behavior::OVInferRequestVariableStateTest;

std::vector<memoryStateParams> memoryStateTestCases = {memoryStateParams(OVInferRequestVariableStateTest::get_network(),
{"c_1-3", "r_1-3"},
ov::test::utils::DEVICE_TEMPLATE,
{})};

INSTANTIATE_TEST_SUITE_P(smoke_Template_BehaviorTests,
OVInferRequestVariableStateTest,
::testing::ValuesIn(memoryStateTestCases),
OVInferRequestVariableStateTest::getTestCaseName);
} // namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "behavior/ov_infer_request/properties_tests.hpp"

#include <vector>

namespace {
using ov::test::behavior::InferRequestPropertiesTest;

const std::vector<ov::AnyMap> configs = {{}};

INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
InferRequestPropertiesTest,
::testing::Combine(::testing::Values(1u),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
InferRequestPropertiesTest::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "behavior/ov_plugin/hetero_synthetic.hpp"

#include <vector>

#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp"
#include "common_test_utils/subgraph_builders/conv_pool_relu_non_zero.hpp"

namespace {
using ov::test::behavior::OVHeteroSyntheticTest;
using ov::test::behavior::PluginParameter;

// this tests load plugin by library name: this is not available during static linkage
#ifndef OPENVINO_STATIC_LIBRARY

INSTANTIATE_TEST_SUITE_P(smoke_manyTargetInputs,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{
{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::withMajorNodesFunctions(
[] {
return ov::test::utils::make_conv_pool2_relu2();
},
{"Conv_1"},
true))),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_SingleMajorNode,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{
{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::_singleMajorNodeFunctions)),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(nightly_RandomMajorNodes,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{
{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::_randomMajorNodeFunctions)),
OVHeteroSyntheticTest::getTestCaseName);

static std::vector<std::function<std::shared_ptr<ov::Model>()>> dynamicBuilders = {
[] {
return ov::test::utils::make_conv_pool_relu_non_zero();
},
};

INSTANTIATE_TEST_SUITE_P(
smoke_NonZeroMajorNode_dynamic,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::withMajorNodesFunctions(dynamicBuilders.front(),
{"nonZero_1"}))),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
smoke_NonZeroMajorNode_dynamic_batch,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::withMajorNodesFunctions(dynamicBuilders.front(),
{"nonZero_1"},
true))),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
smoke_SingleMajorNode_dynamic,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::singleMajorNodeFunctions(dynamicBuilders))),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
nightly_RandomMajorNodes_dynamic,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::randomMajorNodeFunctions(dynamicBuilders))),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
smoke_SingleMajorNode_dynamic_batch,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::singleMajorNodeFunctions(dynamicBuilders, true))),
OVHeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
nightly_RandomMajorNodes_dynamic_batch,
OVHeteroSyntheticTest,
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"TEMPLATE0", "openvino_template_plugin"},
{"TEMPLATE1", "openvino_template_plugin"}}),
::testing::ValuesIn(OVHeteroSyntheticTest::randomMajorNodeFunctions(dynamicBuilders, true))),
OVHeteroSyntheticTest::getTestCaseName);

#endif // !OPENVINO_STATIC_LIBRARY

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class OVHeteroSyntheticTest : public testing::WithParamInterface<OVHeteroSynthet
static std::vector<FunctionParameter> randomMajorNodeFunctions(
const std::vector<std::function<std::shared_ptr<ov::Model>()>>& builders, bool dynamic_batch = false, uint32_t seed = 0);

static std::vector<FunctionParameter> withMajorNodesFunctions(
const std::function<std::shared_ptr<ov::Model>()>& builder,
const std::unordered_set<std::string>& majorNodes,
bool dynamic_batch = false);

static std::vector<FunctionParameter> _singleMajorNodeFunctions;
static std::vector<FunctionParameter> _randomMajorNodeFunctions;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ std::vector<FunctionParameter> OVHeteroSyntheticTest::randomMajorNodeFunctions(
return results;
}

std::vector<FunctionParameter> OVHeteroSyntheticTest::withMajorNodesFunctions(const std::function<std::shared_ptr<ov::Model>()>& builder,
const std::unordered_set<std::string>& majorNodes,
bool dynamic_batch) {
auto function = builder();
std::vector<FunctionParameter> result;
result.push_back(FunctionParameter{majorNodes, function, dynamic_batch, 0});
return result;
}

std::vector<FunctionParameter> OVHeteroSyntheticTest::_singleMajorNodeFunctions
= OVHeteroSyntheticTest::singleMajorNodeFunctions(builders);
Expand Down

0 comments on commit abc2899

Please sign in to comment.