Skip to content

Commit 28a2faf

Browse files
authored
Merge pull request #938 from vinser52/svinogra_tests
Additional tests when CUDA or Level Zero providers are disabled
2 parents 1369352 + 4de4ebf commit 28a2faf

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

test/CMakeLists.txt

Lines changed: 14 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
@@ -400,6 +407,13 @@ if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_CUDA_PROVIDER)
400407
endif()
401408
endif()
402409

410+
if(NOT UMF_BUILD_CUDA_PROVIDER)
411+
add_umf_test(
412+
NAME provider_cuda_not_impl
413+
SRCS providers/provider_cuda_not_impl.cpp
414+
LIBS ${UMF_UTILS_FOR_TEST})
415+
endif()
416+
403417
add_umf_test(
404418
NAME base_alloc
405419
SRCS ${BA_SOURCES_FOR_TEST} test_base_alloc.cpp
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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_cuda.h>
8+
9+
using umf_test::test;
10+
11+
TEST_F(test, cuda_provider_not_implemented) {
12+
umf_cuda_memory_provider_params_handle_t hParams = nullptr;
13+
umf_result_t result = umfCUDAMemoryProviderParamsCreate(&hParams);
14+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
15+
16+
result = umfCUDAMemoryProviderParamsDestroy(hParams);
17+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
18+
19+
result = umfCUDAMemoryProviderParamsSetContext(hParams, nullptr);
20+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
21+
22+
result = umfCUDAMemoryProviderParamsSetDevice(hParams, 0);
23+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
24+
25+
result = umfCUDAMemoryProviderParamsSetMemoryType(hParams,
26+
UMF_MEMORY_TYPE_DEVICE);
27+
ASSERT_EQ(result, UMF_RESULT_ERROR_NOT_SUPPORTED);
28+
29+
umf_memory_provider_ops_t *ops = umfCUDAMemoryProviderOps();
30+
ASSERT_EQ(ops, nullptr);
31+
}
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)