Skip to content

Commit 2365f15

Browse files
committed
Add instantiate for Offline compilation tests
Signed-off-by: Sorin Butnariu <sorin.butnariu@intel.com>
1 parent cb24558 commit 2365f15

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

src/plugins/intel_npu/tests/unit/npu/offline_compilation.cpp

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
using namespace ov::intel_npu;
1717
using namespace ov::test::utils;
1818

19-
class OfflineCompilationUnitTests : public ::testing::Test {
19+
class OfflineCompilationUnitTests : public ::testing::TestWithParam<std::string_view> {
2020
protected:
2121
void SetUp() override {
2222
std::vector<std::string> availableDevices = core.get_available_devices();
@@ -27,35 +27,31 @@ class OfflineCompilationUnitTests : public ::testing::Test {
2727
ov::Core core;
2828
};
2929

30-
TEST_F(OfflineCompilationUnitTests, CompileWithCiPWhenDriverNotInstalledSetProperty) {
31-
const std::vector<std::string_view> platforms = {ov::intel_npu::Platform::NPU5010,
32-
ov::intel_npu::Platform::NPU5020};
30+
TEST_P(OfflineCompilationUnitTests, CompileWithCiPWhenDriverNotInstalledSetProperty) {
31+
const auto platform = GetParam();
3332

34-
for (const auto& platform : platforms) {
35-
ov::AnyMap config;
36-
config[ov::intel_npu::compiler_type.name()] = ov::intel_npu::CompilerType::PLUGIN;
37-
config[ov::intel_npu::platform.name()] = platform;
38-
core.set_property(DEVICE_NPU, config);
33+
ov::AnyMap config;
34+
config[ov::intel_npu::platform.name()] = platform;
35+
core.set_property(DEVICE_NPU, config);
3936

40-
std::shared_ptr<ov::Model> model = ov::test::utils::make_multi_single_conv();
41-
OV_ASSERT_NO_THROW(core.compile_model(model, DEVICE_NPU));
42-
}
37+
std::shared_ptr<ov::Model> model = ov::test::utils::make_multi_single_conv();
38+
OV_ASSERT_NO_THROW(core.compile_model(model, DEVICE_NPU));
4339
}
4440

45-
TEST_F(OfflineCompilationUnitTests, CompileWithCiPWhenDriverNotInstalled) {
46-
const std::vector<std::string_view> platforms = {ov::intel_npu::Platform::NPU5010,
47-
ov::intel_npu::Platform::NPU5020};
41+
TEST_P(OfflineCompilationUnitTests, CompileWithCiPWhenDriverNotInstalled) {
42+
const auto platform = GetParam();
4843

49-
for (const auto& platform : platforms) {
50-
ov::AnyMap config;
51-
config[ov::intel_npu::compiler_type.name()] = ov::intel_npu::CompilerType::PLUGIN;
52-
config[ov::intel_npu::platform.name()] = platform;
44+
ov::AnyMap config;
45+
config[ov::intel_npu::platform.name()] = platform;
5346

54-
std::shared_ptr<ov::Model> model = ov::test::utils::make_multi_single_conv();
55-
OV_ASSERT_NO_THROW(core.compile_model(model, DEVICE_NPU, config));
56-
}
47+
std::shared_ptr<ov::Model> model = ov::test::utils::make_multi_single_conv();
48+
OV_ASSERT_NO_THROW(core.compile_model(model, DEVICE_NPU, config));
5749
}
5850

51+
INSTANTIATE_TEST_SUITE_P(OfflineCompilationPlatforms,
52+
OfflineCompilationUnitTests,
53+
::testing::Values(ov::intel_npu::Platform::NPU5010, ov::intel_npu::Platform::NPU5020));
54+
5955
using UnavailableDeviceTests = ::testing::Test;
6056

6157
TEST_F(UnavailableDeviceTests, GetDeviceNotAvailable) {

0 commit comments

Comments
 (0)