Skip to content
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
17 changes: 15 additions & 2 deletions test/provider_devdax_memory.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// Copyright (C) 2024-2025 Intel Corporation
// Copyright (C) 2024-2026 Intel Corporation
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef _WIN32
#include <fcntl.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif

#include <cerrno>

#include <umf/experimental/ctl.h>
#include <umf/memory_provider.h>
#include <umf/providers/provider_devdax_memory.h>
Expand Down Expand Up @@ -132,7 +135,17 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) {
GTEST_SKIP() << "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set";
}

size_t size = atol(size_str);
// Parse the size string to an unsigned long long and check for errors
char *end = nullptr;
errno = 0;
unsigned long long parsed_size = strtoull(size_str, &end, 10);
ASSERT_EQ(errno, 0);
ASSERT_NE(end, size_str);
ASSERT_EQ(*end, '\0');

ASSERT_GT(parsed_size, 0);
ASSERT_LE(parsed_size, static_cast<unsigned long long>(SSIZE_MAX));
size_t size = static_cast<size_t>(parsed_size);
umf_devdax_memory_provider_params_handle_t params = NULL;
umf_result = umfDevDaxMemoryProviderParamsCreate(path, size, &params);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);
Expand Down
Loading