From 8d8958110a375e18bba9d13b16bf4c5a065bae2b 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-tests commit: 2da551c6590a098ee912564d14b49869c37c147f] --- .../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)); +} +