Skip to content

Commit 484dea0

Browse files
Jaime ArteagaCompute-Runtime-Automation
authored andcommitted
Add missing ULTs for driverHandleImp
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
1 parent 232640a commit 484dea0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

level_zero/core/source/driver/driver_handle_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ ze_result_t DriverHandleImp::getDevice(uint32_t *pCount, ze_device_handle_t *phD
235235
}
236236

237237
if (phDevices == nullptr) {
238-
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
238+
return ZE_RESULT_ERROR_INVALID_NULL_HANDLE;
239239
}
240240

241241
for (uint32_t i = 0; i < *pCount; i++) {

level_zero/core/test/unit_tests/sources/driver/test_driver.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,19 @@ TEST_F(DriverHandleTest, givenInitializedDriverWhenGetDeviceIsCalledThenOneDevic
460460
EXPECT_NE(nullptr, &device);
461461
}
462462

463+
TEST_F(DriverHandleTest, whenQueryingForApiVersionThenExpectedVersionIsReturned) {
464+
ze_api_version_t version = {};
465+
ze_result_t result = driverHandle->getApiVersion(&version);
466+
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
467+
EXPECT_EQ(ZE_API_VERSION_1_1, version);
468+
}
469+
470+
TEST_F(DriverHandleTest, whenQueryingForDevicesWithCountGreaterThanZeroAndNullDevicePointerThenNullHandleIsReturned) {
471+
uint32_t count = 1;
472+
ze_result_t result = driverHandle->getDevice(&count, nullptr);
473+
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_NULL_HANDLE, result);
474+
}
475+
463476
TEST_F(DriverHandleTest, givenValidDriverHandleWhenGetSvmAllocManagerIsCalledThenSvmAllocsManagerIsObtained) {
464477
auto svmAllocsManager = driverHandle->getSvmAllocsManager();
465478
EXPECT_NE(nullptr, svmAllocsManager);

0 commit comments

Comments
 (0)