Skip to content

Commit b4fd275

Browse files
authored
test: CTS for zesDeviceGetSubDeviceProperties API (#63)
Related to VLCLJ-2248 Signed-off-by: Bagria, Narendra <narendra.bagria@intel.com>
1 parent a96c15c commit b4fd275

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

conformance_tests/sysman/test_sysman_device/src/test_sysman_device.cpp

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ class SysmanDeviceTest : public lzt::SysmanCtsClass {};
5252
#define SYSMAN_DEVICE_TEST SysmanDeviceTest
5353
#endif // USE_ZESINIT
5454

55+
#ifdef USE_ZESINIT
56+
bool is_uuid_pair_equal(uint8_t *uuid1, uint8_t *uuid2);
57+
#endif // USE_ZESINIT
58+
5559
void run_device_hierarchy_child_process() {
5660
fs::path helper_path(fs::current_path() / "sysman_device");
5761
std::vector<fs::path> paths;
@@ -169,6 +173,29 @@ TEST_F(
169173
}
170174
}
171175

176+
#ifdef USE_ZESINIT
177+
TEST_F(
178+
SYSMAN_DEVICE_TEST,
179+
GivenValidDeviceWhenRetrievingSubDevicesThenEnsureNoSubDeviceUUIDMatchesDeviceUUID) {
180+
for (auto device : devices) {
181+
auto device_properties = lzt::get_sysman_device_properties(device);
182+
uint32_t sub_devices_count = device_properties.numSubdevices;
183+
if (sub_devices_count > 0) {
184+
uint32_t num_sub_devices = 0;
185+
auto sub_device_properties =
186+
lzt::get_sysman_subdevice_properties(device, num_sub_devices);
187+
EXPECT_EQ(sub_devices_count, num_sub_devices);
188+
for (uint32_t sub_device_index = 0; sub_device_index < num_sub_devices;
189+
sub_device_index++) {
190+
EXPECT_FALSE(
191+
is_uuid_pair_equal(sub_device_properties[sub_device_index].uuid.id,
192+
device_properties.core.uuid.id));
193+
}
194+
}
195+
}
196+
}
197+
#endif // USE_ZESINIT
198+
172199
TEST_F(
173200
SYSMAN_DEVICE_TEST,
174201
GivenValidDriverWhenRetrievingDeviceHandleFromUUIDThenReturnedDeviceHandleShouldMatchCurrentDeviceHandle) {
@@ -446,7 +473,7 @@ static void compare_results(std::vector<float> c, std::vector<float> c_cpu) {
446473
}
447474

448475
#ifdef USE_ZESINIT
449-
bool is_uuids_equal(uint8_t *uuid1, uint8_t *uuid2) {
476+
bool is_uuid_pair_equal(uint8_t *uuid1, uint8_t *uuid2) {
450477
for (uint32_t i = 0; i < ZE_MAX_UUID_SIZE; i++) {
451478
if (uuid1[i] != uuid2[i]) {
452479
return false;
@@ -460,7 +487,7 @@ ze_device_handle_t get_core_device_by_uuid(uint8_t *uuid) {
460487
auto core_devices = lzt::get_ze_devices(driver);
461488
for (auto device : core_devices) {
462489
auto device_properties = lzt::get_device_properties(device);
463-
if (is_uuids_equal(uuid, device_properties.uuid.id)) {
490+
if (is_uuid_pair_equal(uuid, device_properties.uuid.id)) {
464491
return device;
465492
}
466493
}

conformance_tests/sysman/test_sysman_engine/src/test_sysman_engine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static void workload_for_device(ze_device_handle_t device) {
253253
}
254254

255255
#ifdef USE_ZESINIT
256-
bool is_uuids_equal(uint8_t *uuid1, uint8_t *uuid2) {
256+
bool is_uuid_pair_equal(uint8_t *uuid1, uint8_t *uuid2) {
257257
for (uint32_t i = 0; i < ZE_MAX_UUID_SIZE; i++) {
258258
if (uuid1[i] != uuid2[i]) {
259259
return false;
@@ -267,7 +267,7 @@ ze_device_handle_t get_core_device_by_uuid(uint8_t *uuid) {
267267
auto core_devices = lzt::get_ze_devices(driver);
268268
for (auto device : core_devices) {
269269
auto device_properties = lzt::get_device_properties(device);
270-
if (is_uuids_equal(uuid, device_properties.uuid.id)) {
270+
if (is_uuid_pair_equal(uuid, device_properties.uuid.id)) {
271271
return device;
272272
}
273273
}

conformance_tests/sysman/test_sysman_frequency/src/test_sysman_frequency.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ void get_throttle_time_init(zes_freq_handle_t pfreq_handle,
464464
}
465465

466466
#ifdef USE_ZESINIT
467-
bool is_uuids_equal(uint8_t *uuid1, uint8_t *uuid2) {
467+
bool is_uuid_pair_equal(uint8_t *uuid1, uint8_t *uuid2) {
468468
for (uint32_t i = 0; i < ZE_MAX_UUID_SIZE; i++) {
469469
if (uuid1[i] != uuid2[i]) {
470470
return false;
@@ -478,7 +478,7 @@ ze_device_handle_t get_core_device_by_uuid(uint8_t *uuid) {
478478
auto core_devices = lzt::get_ze_devices(driver);
479479
for (auto device : core_devices) {
480480
auto device_properties = lzt::get_device_properties(device);
481-
if (is_uuids_equal(uuid, device_properties.uuid.id)) {
481+
if (is_uuid_pair_equal(uuid, device_properties.uuid.id)) {
482482
return device;
483483
}
484484
}

conformance_tests/sysman/test_sysman_memory/src/test_sysman_memory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ uint64_t get_free_memory_state(ze_device_handle_t device) {
229229
}
230230

231231
#ifdef USE_ZESINIT
232-
bool is_uuids_equal(uint8_t *uuid1, uint8_t *uuid2) {
232+
bool is_uuid_pair_equal(uint8_t *uuid1, uint8_t *uuid2) {
233233
for (uint32_t i = 0; i < ZE_MAX_UUID_SIZE; i++) {
234234
if (uuid1[i] != uuid2[i]) {
235235
return false;
@@ -243,7 +243,7 @@ ze_device_handle_t get_core_device_by_uuid(uint8_t *uuid) {
243243
auto core_devices = lzt::get_ze_devices(driver);
244244
for (auto device : core_devices) {
245245
auto device_properties = lzt::get_device_properties(device);
246-
if (is_uuids_equal(uuid, device_properties.uuid.id)) {
246+
if (is_uuid_pair_equal(uuid, device_properties.uuid.id)) {
247247
return device;
248248
}
249249
}

0 commit comments

Comments
 (0)