Skip to content

Commit 31372be

Browse files
committed
Add test for not implemented file provider
1 parent c063605 commit 31372be

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
338338
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND UMF_BUILD_FUZZTESTS)
339339
add_subdirectory(fuzz)
340340
endif()
341+
else()
342+
add_umf_test(
343+
NAME provider_file_memory_not_impl
344+
SRCS provider_file_memory_not_impl.cpp
345+
LIBS ${UMF_UTILS_FOR_TEST})
341346
endif()
342347

343348
if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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_file_memory.h>
8+
9+
using umf_test::test;
10+
11+
TEST_F(test, file_provider_not_implemented) {
12+
umf_file_memory_provider_params_handle_t params = nullptr;
13+
umf_result_t umf_result =
14+
umfFileMemoryProviderParamsCreate(&params, "path");
15+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
16+
EXPECT_EQ(params, nullptr);
17+
18+
umf_result = umfFileMemoryProviderParamsDestroy(nullptr);
19+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
20+
21+
umf_result = umfFileMemoryProviderParamsSetPath(nullptr, "path");
22+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
23+
24+
umf_result = umfFileMemoryProviderParamsSetProtection(nullptr, 0);
25+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
26+
27+
umf_result =
28+
umfFileMemoryProviderParamsSetVisibility(nullptr, UMF_MEM_MAP_PRIVATE);
29+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
30+
31+
umf_memory_provider_ops_t *ops = umfFileMemoryProviderOps();
32+
EXPECT_EQ(ops, nullptr);
33+
}

0 commit comments

Comments
 (0)