Skip to content

Commit 3986f1c

Browse files
committed
test: Add Sysman VF Management CTS
Related-To: VLCLJ-2312 Signed-off-by: Vishnu Khanth <[email protected]>
1 parent 81a8f00 commit 3986f1c

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

conformance_tests/sysman/test_sysman_vf_management/src/test_sysman_vf_management.cpp

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ namespace lzt = level_zero_tests;
1313
namespace {
1414

1515
#ifdef USE_ZESINIT
16-
class VfManagementZesTest : public lzt::ZesSysmanCtsClass {};
16+
class VfManagementZesTest : public lzt::ZesSysmanCtsClass {
17+
public:
18+
bool is_vf_enabled = false;
19+
};
1720
#define VF_MANAGEMENT_TEST VfManagementZesTest
1821
#else // USE_ZESINIT
19-
class VfManagementTest : public lzt::SysmanCtsClass {};
22+
class VfManagementTest : public lzt::SysmanCtsClass {
23+
public:
24+
bool is_vf_enabled = false;
25+
};
2026
#define VF_MANAGEMENT_TEST VfManagementTest
2127
#endif // USE_ZESINIT
2228

@@ -57,6 +63,7 @@ TEST_F(
5763
for (auto device : devices) {
5864
uint32_t count = lzt::get_vf_handles_count(device);
5965
if (count > 0) {
66+
is_vf_enabled = true;
6067
LOG_INFO << "VF is enabled on this device!!";
6168
auto vf_handles = lzt::get_vf_handles(device, count);
6269

@@ -67,6 +74,10 @@ TEST_F(
6774
LOG_INFO << "No VF handles found for this device!";
6875
}
6976
}
77+
78+
if (!is_vf_enabled) {
79+
FAIL() << "No VF handles found in all devices!!";
80+
}
7081
}
7182

7283
TEST_F(
@@ -87,13 +98,18 @@ TEST_F(
8798
}
8899

89100
if (count_initial > 0 && count_later > 0) {
101+
is_vf_enabled = true;
90102
LOG_INFO << "VF is enabled on this device!!";
91103
EXPECT_EQ(count_initial, count_later);
92104
EXPECT_EQ(vf_handles_initial, vf_handles_later);
93105
} else {
94106
LOG_INFO << "No VF handles found for this device!";
95107
}
96108
}
109+
110+
if (!is_vf_enabled) {
111+
FAIL() << "No VF handles found in all devices!!";
112+
}
97113
}
98114

99115
TEST_F(
@@ -102,6 +118,7 @@ TEST_F(
102118
for (auto device : devices) {
103119
uint32_t count = lzt::get_vf_handles_count(device);
104120
if (count > 0) {
121+
is_vf_enabled = true;
105122
LOG_INFO << "VF is enabled on this device!!";
106123
uint32_t test_count = count + 1;
107124
auto vf_handles = lzt::get_vf_handles(device, test_count);
@@ -115,6 +132,10 @@ TEST_F(
115132
LOG_INFO << "No VF handles found for this device!";
116133
}
117134
}
135+
136+
if (!is_vf_enabled) {
137+
FAIL() << "No VF handles found in all devices!!";
138+
}
118139
}
119140

120141
TEST_F(
@@ -123,6 +144,7 @@ TEST_F(
123144
for (auto device : devices) {
124145
uint32_t count = lzt::get_vf_handles_count(device);
125146
if (count > 1) {
147+
is_vf_enabled = true;
126148
LOG_INFO << "VF is enabled on this device!!";
127149
uint32_t test_count = count - 1;
128150
auto vf_handles = lzt::get_vf_handles(device, test_count);
@@ -132,11 +154,16 @@ TEST_F(
132154
EXPECT_NE(vf_handle, nullptr);
133155
}
134156
} else if (count == 1) {
157+
is_vf_enabled = true;
135158
LOG_INFO << "Insufficient number of VF handles to validate this test";
136159
} else {
137160
LOG_INFO << "No VF handles found for this device!!";
138161
}
139162
}
163+
164+
if (!is_vf_enabled) {
165+
FAIL() << "No VF handles found in all devices!!";
166+
}
140167
}
141168

142169
TEST_F(
@@ -145,6 +172,7 @@ TEST_F(
145172
for (auto device : devices) {
146173
uint32_t count = lzt::get_vf_handles_count(device);
147174
if (count > 0) {
175+
is_vf_enabled = true;
148176
LOG_INFO << "VF is enabled on this device!!";
149177
auto vf_handles = lzt::get_vf_handles(device, count);
150178

@@ -156,6 +184,10 @@ TEST_F(
156184
LOG_INFO << "No VF handles found for this device!!";
157185
}
158186
}
187+
188+
if (!is_vf_enabled) {
189+
FAIL() << "No VF handles found in all devices!!";
190+
}
159191
}
160192

161193
TEST_F(
@@ -164,6 +196,7 @@ TEST_F(
164196
for (auto device : devices) {
165197
uint32_t count = lzt::get_vf_handles_count(device);
166198
if (count > 0) {
199+
is_vf_enabled = true;
167200
LOG_INFO << "VF is enabled on this device!!";
168201
auto vf_handles = lzt::get_vf_handles(device, count);
169202

@@ -176,6 +209,10 @@ TEST_F(
176209
LOG_INFO << "No VF handles found for this device!!";
177210
}
178211
}
212+
213+
if (!is_vf_enabled) {
214+
FAIL() << "No VF handles found in all devices!!";
215+
}
179216
}
180217

181218
TEST_F(VF_MANAGEMENT_TEST,
@@ -184,6 +221,7 @@ TEST_F(VF_MANAGEMENT_TEST,
184221
uint32_t count = lzt::get_vf_handles_count(device);
185222
if (count > 1) {
186223
std::vector<uint32_t> vf_ids{};
224+
is_vf_enabled = true;
187225
LOG_INFO << "VF is enabled on this device!!";
188226
auto vf_handles = lzt::get_vf_handles(device, count);
189227

@@ -195,11 +233,16 @@ TEST_F(VF_MANAGEMENT_TEST,
195233
std::set<uint32_t> unique_vf_ids(vf_ids.begin(), vf_ids.end());
196234
EXPECT_EQ(vf_ids.size(), unique_vf_ids.size());
197235
} else if (count == 1) {
236+
is_vf_enabled = true;
198237
LOG_INFO << "Insufficient number of VF handles to validate this test";
199238
} else {
200239
LOG_INFO << "No VF handles found for this device!!";
201240
}
202241
}
242+
243+
if (!is_vf_enabled) {
244+
FAIL() << "No VF handles found in all devices!!";
245+
}
203246
}
204247

205248
} // namespace

0 commit comments

Comments
 (0)