| 1 | //===------- Offload API tests - olDestroyEvent ---------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "../common/Fixtures.hpp" |
| 10 | #include <OffloadAPI.h> |
| 11 | #include <gtest/gtest.h> |
| 12 | |
| 13 | using olDestroyEventTest = OffloadQueueTest; |
| 14 | OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olDestroyEventTest); |
| 15 | |
| 16 | TEST_P(olDestroyEventTest, Success) { |
| 17 | uint32_t Src = 42; |
| 18 | void *DstPtr; |
| 19 | |
| 20 | ol_event_handle_t Event = nullptr; |
| 21 | ASSERT_SUCCESS( |
| 22 | olMemAlloc(Device, OL_ALLOC_TYPE_DEVICE, sizeof(uint32_t), &DstPtr)); |
| 23 | ASSERT_SUCCESS( |
| 24 | olMemcpy(Queue, DstPtr, Device, &Src, Host, sizeof(Src), &Event)); |
| 25 | ASSERT_NE(Event, nullptr); |
| 26 | ASSERT_SUCCESS(olWaitQueue(Queue)); |
| 27 | ASSERT_SUCCESS(olDestroyEvent(Event)); |
| 28 | } |
| 29 | |
| 30 | TEST_P(olDestroyEventTest, InvalidNullEvent) { |
| 31 | ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, olDestroyEvent(nullptr)); |
| 32 | } |
| 33 | |