Skip to content

Commit 5df314e

Browse files
committed
Add test for not implemented OS provider
1 parent 24e7119 commit 5df314e

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
339339
add_subdirectory(fuzz)
340340
endif()
341341
else()
342+
add_umf_test(
343+
NAME provider_os_memory_not_impl
344+
SRCS provider_os_memory_not_impl.cpp
345+
LIBS ${UMF_UTILS_FOR_TEST})
342346
add_umf_test(
343347
NAME provider_file_memory_not_impl
344348
SRCS provider_file_memory_not_impl.cpp
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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_os_memory.h>
8+
9+
using umf_test::test;
10+
11+
TEST_F(test, os_provider_not_implemented) {
12+
umf_os_memory_provider_params_handle_t params = nullptr;
13+
umf_result_t umf_result = umfOsMemoryProviderParamsCreate(&params);
14+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
15+
EXPECT_EQ(params, nullptr);
16+
17+
umf_result = umfOsMemoryProviderParamsDestroy(params);
18+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
19+
20+
umf_result = umfOsMemoryProviderParamsSetProtection(params, 0);
21+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
22+
23+
umf_result =
24+
umfOsMemoryProviderParamsSetVisibility(params, UMF_MEM_MAP_PRIVATE);
25+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
26+
27+
umf_result = umfOsMemoryProviderParamsSetShmName(params, "shm_name");
28+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
29+
30+
umf_result = umfOsMemoryProviderParamsSetNumaList(params, nullptr, 0);
31+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
32+
33+
umf_result =
34+
umfOsMemoryProviderParamsSetNumaMode(params, UMF_NUMA_MODE_DEFAULT);
35+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
36+
37+
umf_result = umfOsMemoryProviderParamsSetPartSize(params, 4096);
38+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
39+
40+
umf_numa_split_partition_t partitions[1];
41+
umf_result = umfOsMemoryProviderParamsSetPartitions(params, partitions, 1);
42+
EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED);
43+
}

0 commit comments

Comments
 (0)