Skip to content

Commit 4de4ebf

Browse files
committed
Add test for not implemented CUDA provider
1 parent dcf0452 commit 4de4ebf

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_CUDA_PROVIDER)
407407
endif()
408408
endif()
409409

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+
410417
add_umf_test(
411418
NAME base_alloc
412419
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+
}

0 commit comments

Comments
 (0)