[llvm] [libsycl][unit] Use mock dummy handle functions for olMemAlloc functions (PR #216341)
Nick Sarnie via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 08:34:36 PDT 2026
https://github.com/sarnex created https://github.com/llvm/llvm-project/pull/216341
None
>From 5c09006daf855cbf8f56dfb3ae1b688f0320825b Mon Sep 17 00:00:00 2001
From: Nick Sarnie <nick.sarnie at intel.com>
Date: Fri, 14 Aug 2026 08:33:55 -0700
Subject: [PATCH] [libsycl][unit] Use mock dummy handle functions for
olMemAlloc functions
Signed-off-by: Nick Sarnie <nick.sarnie at intel.com>
---
libsycl/unittests/mock/helpers.cpp | 6 +++---
libsycl/unittests/mock/helpers.hpp | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/libsycl/unittests/mock/helpers.cpp b/libsycl/unittests/mock/helpers.cpp
index ea36e5188915e..f12e8509f1dce 100644
--- a/libsycl/unittests/mock/helpers.cpp
+++ b/libsycl/unittests/mock/helpers.cpp
@@ -335,7 +335,7 @@ void mock::MockLiboffload::initDefault() {
EXPECT_NE(Type, OL_ALLOC_TYPE_HOST);
EXPECT_GT(Size, 0);
EXPECT_NE(AllocationOut, nullptr);
- *AllocationOut = std::malloc(Size);
+ *AllocationOut = mock::createDummyHandle<void *>(Size);
return OL_SUCCESS;
});
@@ -345,13 +345,13 @@ void mock::MockLiboffload::initDefault() {
EXPECT_NE(Device, nullptr);
EXPECT_GT(Size, 0);
EXPECT_NE(AllocationOut, nullptr);
- *AllocationOut = std::malloc(Size);
+ *AllocationOut = mock::createDummyHandle<void *>(Size);
return OL_SUCCESS;
});
ON_CALL(*this, olMemFree).WillByDefault([this](void *Address) -> ol_result_t {
EXPECT_NE(Address, nullptr);
- std::free(Address);
+ mock::releaseDummyHandle(Address);
return OL_SUCCESS;
});
}
diff --git a/libsycl/unittests/mock/helpers.hpp b/libsycl/unittests/mock/helpers.hpp
index e1f1672ea4512..174bd24a139b7 100644
--- a/libsycl/unittests/mock/helpers.hpp
+++ b/libsycl/unittests/mock/helpers.hpp
@@ -22,7 +22,6 @@
#include <atomic>
#include <cassert>
#include <cstddef>
-#include <cstdlib>
#include <cstring>
#include <unordered_map>
#include <vector>
More information about the llvm-commits
mailing list