From 4fd14eda91729fe005ccc0f6983cddc0b64c09d9 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Wed, 15 Jun 2022 11:29:21 +0530 Subject: [PATCH] SWDEV-330666 - Test cases for null stream and/or priority. (#2651) Change-Id: I9f5c99513fa1c754c2ab2e3cb9dcd5b6a3bb0176 [ROCm/hip-tests commit: eb22c8be116283814adf97e7fb77dd3331e3f651] --- .../catch/unit/stream/hipStreamGetPriority.cc | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/projects/hip-tests/catch/unit/stream/hipStreamGetPriority.cc b/projects/hip-tests/catch/unit/stream/hipStreamGetPriority.cc index ac68a9396a..e2384edd8e 100644 --- a/projects/hip-tests/catch/unit/stream/hipStreamGetPriority.cc +++ b/projects/hip-tests/catch/unit/stream/hipStreamGetPriority.cc @@ -89,6 +89,50 @@ TEST_CASE("Unit_hipStreamGetPriority_happy") { } } +/** + * both stream and priority passed as nullptr. + */ +TEST_CASE("Unit_hipStreamGetPriority_nullptr_nullptr") { + auto res = hipStreamGetPriority(nullptr,nullptr); + REQUIRE(res == hipErrorInvalidValue); +} + + +/** + * valid stream and priority passed as nullptr. + */ +TEST_CASE("Unit_hipStreamGetPriority_stream_nullptr") { + hipStream_t stream = nullptr; + HIP_CHECK(hipStreamCreate(&stream)); + + auto res = hipStreamGetPriority(stream,nullptr); + REQUIRE(res == hipErrorInvalidValue); + + HIP_CHECK(hipStreamDestroy(stream)); +} + + +/** + * nullptr stream and valid priority + */ +TEST_CASE("Unit_hipStreamGetPriority_nullptr_priority") { + int priority = -1; + HIP_CHECK(hipStreamGetPriority(nullptr,&priority)); +} + +/** + * both stream and priority passed as valid. + */ +TEST_CASE("Unit_hipStreamGetPriority_stream_priority") { + int priority = -1; + hipStream_t stream = nullptr; + HIP_CHECK(hipStreamCreate(&stream)); + + HIP_CHECK(hipStreamGetPriority(stream,&priority)); + + HIP_CHECK(hipStreamDestroy(stream)); +} + #if HT_AMD /** * Create stream with CUMask and check priority is returned as expected.