From 88b11a140126d0c0cd150f51f77ebe86aa6596f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio?= Date: Mon, 20 Jun 2022 11:51:01 +0100 Subject: [PATCH] EXSWCPHIPT-107: Added testing for hipEventCreate (#2729) [ROCm/hip commit: 50829a3b00566604f165594b5bc90a864030e38b] --- .../unit/event/Unit_hipEvent_Negative.cc | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/projects/hip/tests/catch/unit/event/Unit_hipEvent_Negative.cc b/projects/hip/tests/catch/unit/event/Unit_hipEvent_Negative.cc index 1d8b2b29a4..76b75d6c06 100644 --- a/projects/hip/tests/catch/unit/event/Unit_hipEvent_Negative.cc +++ b/projects/hip/tests/catch/unit/event/Unit_hipEvent_Negative.cc @@ -1,5 +1,5 @@ /* -Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -46,3 +46,34 @@ TEST_CASE("Unit_hipEventDestroy_NullCheck") { auto res = hipEventDestroy(nullptr); REQUIRE(res != hipSuccess); } + +TEST_CASE("Unit_hipEventCreate_IncompatibleFlags") { + hipEvent_t event; + +#if HT_AMD + HipTest::HIP_SKIP_TEST("EXSWCPHIPT-106"); + return; +#endif + + HIP_CHECK_ERROR(hipEventCreateWithFlags(&event, hipEventInterprocess), hipErrorInvalidValue); + +#if HT_AMD + HIP_CHECK_ERROR( + hipEventCreateWithFlags(&event, hipEventReleaseToDevice | hipEventReleaseToSystem), + hipErrorInvalidValue); +#endif + + unsigned allFlags{hipEventReleaseToDevice | hipEventReleaseToSystem | hipEventBlockingSync | + hipEventDisableTiming | hipEventDefault | hipEventInterprocess}; + +#if HT_AMD + HIP_CHECK_ERROR(hipEventCreateWithFlags(&event, allFlags), hipErrorInvalidValue); +#else + /* Works on Non-AMD because hipEventReleaseToDevice / hipEventReleaseToSystem have no meaning in + * that case */ + HIP_CHECK(hipEventCreateWithFlags(&event, allFlags)); +#endif + + unsigned invalidFlag{0x08000000}; + HIP_CHECK_ERROR(hipEventCreateWithFlags(&event, invalidFlag), hipErrorInvalidValue); +} \ No newline at end of file