-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f17bf95
commit a3b7f9b
Showing
3 changed files
with
121 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* | ||
* Copyright (C) 2023 Intel Corporation | ||
* | ||
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See LICENSE.TXT | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
*/ | ||
|
||
#ifndef USM_TEST_POOL_HPP | ||
#define USM_TEST_POOL_HPP 1 | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <umf/base.h> | ||
#include <umf/memory_provider.h> | ||
|
||
#include "umf_helpers.hpp" | ||
|
||
namespace usm_test { | ||
|
||
struct null_pool { | ||
umf_result_t initialize(umf_memory_provider_handle_t *, size_t) noexcept { | ||
return UMF_RESULT_SUCCESS; | ||
}; | ||
void *malloc(size_t) noexcept { return nullptr; } | ||
void *calloc(size_t, size_t) noexcept { return nullptr; } | ||
void *realloc(void *, size_t) noexcept { return nullptr; } | ||
void *aligned_malloc(size_t, size_t) noexcept { return nullptr; } | ||
enum umf_result_t free(void *) noexcept { return UMF_RESULT_SUCCESS; } | ||
size_t malloc_usable_size(void *) noexcept { return 0; } | ||
enum umf_result_t get_last_allocation_error() noexcept { | ||
return UMF_RESULT_SUCCESS; | ||
} | ||
}; | ||
|
||
umf::pool_unique_handle_t | ||
nullPoolCreate(umf_memory_provider_handle_t *provider) { | ||
auto [ret, pool] = umf::poolMakeUnique<null_pool>(provider, 1); | ||
EXPECT_EQ(ret, UMF_RESULT_SUCCESS); | ||
|
||
return std::move(pool); | ||
} | ||
|
||
} // namespace usm_test | ||
|
||
#endif /* USM_TEST_POOL_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters