Skip to content

Commit dcf0452

Browse files
committed
Add test for not implemented Level Zero provider
1 parent 1369352 commit dcf0452

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

test/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,13 @@ if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
368368
PRIVATE ${LEVEL_ZERO_INCLUDE_DIRS})
369369
endif()
370370

371+
if(NOT UMF_BUILD_LEVEL_ZERO_PROVIDER)
372+
add_umf_test(
373+
NAME provider_level_zero_not_impl
374+
SRCS providers/provider_level_zero_not_impl.cpp
375+
LIBS ${UMF_UTILS_FOR_TEST})
376+
endif()
377+
371378
if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_CUDA_PROVIDER)
372379
if(UMF_CUDA_ENABLED)
373380
# we have two test binaries here that use the same sources, but differ
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (C) 2024 Intel Corporation
2+
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#include "base.hpp"
6+
7+
#include <umf/providers/provider_level_zero.h>
8+
9+
using umf_test::test;
10+
11+
TEST_F(test, level_zero_provider_not_implemented) {
12+
umf_level_zero_memory_provider_params_handle_t hParams = nullptr;
13+
umf_result_t result = umfLevelZeroMemoryProviderParamsCreate(&hParams);
14+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
15+
16+
result = umfLevelZeroMemoryProviderParamsDestroy(hParams);
17+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
18+
19+
result = umfLevelZeroMemoryProviderParamsSetContext(hParams, nullptr);
20+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
21+
22+
result = umfLevelZeroMemoryProviderParamsSetDevice(hParams, nullptr);
23+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
24+
25+
result = umfLevelZeroMemoryProviderParamsSetMemoryType(
26+
hParams, UMF_MEMORY_TYPE_DEVICE);
27+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
28+
29+
ze_device_handle_t hDevices[1];
30+
result = umfLevelZeroMemoryProviderParamsSetResidentDevices(hParams,
31+
hDevices, 1);
32+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
33+
34+
umf_memory_provider_ops_t *ops = umfLevelZeroMemoryProviderOps();
35+
ASSERT_EQ(ops, nullptr);
36+
}

0 commit comments

Comments
 (0)