Skip to content

Refactor providerCreateExt() #719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions test/provider_os_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,29 @@ static int compare_native_error_str(const char *message, int error) {

using providerCreateExtParams = std::tuple<umf_memory_provider_ops_t *, void *>;

umf::provider_unique_handle_t
providerCreateExt(providerCreateExtParams params) {
static void providerCreateExt(providerCreateExtParams params,
umf::provider_unique_handle_t *handle) {
umf_memory_provider_handle_t hProvider = nullptr;
auto [provider_ops, provider_params] = params;

auto ret =
umfMemoryProviderCreate(provider_ops, provider_params, &hProvider);
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);
EXPECT_NE(hProvider, nullptr);
ASSERT_EQ(ret, UMF_RESULT_SUCCESS);
ASSERT_NE(hProvider, nullptr);

return umf::provider_unique_handle_t(hProvider, &umfMemoryProviderDestroy);
*handle =
umf::provider_unique_handle_t(hProvider, &umfMemoryProviderDestroy);
}

struct umfProviderTest
: umf_test::test,
::testing::WithParamInterface<providerCreateExtParams> {
void SetUp() override {
test::SetUp();
provider = providerCreateExt(this->GetParam());
providerCreateExt(this->GetParam(), &provider);
umf_result_t umf_result =
umfMemoryProviderGetMinPageSize(provider.get(), NULL, &page_size);
EXPECT_EQ(umf_result, UMF_RESULT_SUCCESS);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);

page_plus_64 = page_size + 64;
}
Expand Down
Loading