From e1762bfea6d532ab5473f42c2c0366278f7ed78f Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 17 Jun 2022 09:35:56 +0530 Subject: [PATCH] SWDEV-330661 - Add test for hipHostGetDevicePointer null check (#2745) Change-Id: I19668385003a107e21f8484ef28e114b7c6d8a42 [ROCm/hip commit: d3a062a4ebc1d79fadbcb2386dd9453218c8e940] --- .../hip/tests/catch/unit/memory/hipHostMalloc.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/hip/tests/catch/unit/memory/hipHostMalloc.cc b/projects/hip/tests/catch/unit/memory/hipHostMalloc.cc index 94f943c6bf..39a2bb6719 100644 --- a/projects/hip/tests/catch/unit/memory/hipHostMalloc.cc +++ b/projects/hip/tests/catch/unit/memory/hipHostMalloc.cc @@ -231,4 +231,16 @@ TEST_CASE("Unit_hipHostMalloc_Default") { CheckHostPointer(numElements, A, 0, SYNC_DEVICE, ptrType); CheckHostPointer(numElements, A, 0, SYNC_STREAM, ptrType); CheckHostPointer(numElements, A, 0, SYNC_EVENT, ptrType); + } + +TEST_CASE("Unit_hipHostGetDevicePointer_NullCheck") { + int* d_a; + HIP_CHECK(hipHostMalloc(reinterpret_cast(&d_a), sizeof(int))); + + auto res = hipHostGetDevicePointer(nullptr,d_a,0); + REQUIRE(res == hipErrorInvalidValue); + + HIP_CHECK(hipHostFree(d_a)); +} +