1//===------- Offload API tests - olWaitEvent -====-------------------------===//
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
13using olWaitEventTest = OffloadQueueTest;
14OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olWaitEventTest);
15
16TEST_P(olWaitEventTest, Success) {
17 if (getPlatformBackend() == OL_PLATFORM_BACKEND_AMDGPU)
18 GTEST_SKIP() << "AMDGPU synchronize event not implemented";
19
20 uint32_t Src = 42;
21 void *DstPtr;
22
23 ol_event_handle_t Event = nullptr;
24 ASSERT_SUCCESS(
25 olMemAlloc(Device, OL_ALLOC_TYPE_DEVICE, sizeof(uint32_t), &DstPtr));
26 ASSERT_SUCCESS(
27 olMemcpy(Queue, DstPtr, Device, &Src, Host, sizeof(Src), &Event));
28 ASSERT_NE(Event, nullptr);
29 ASSERT_SUCCESS(olWaitEvent(Event));
30 ASSERT_SUCCESS(olDestroyEvent(Event));
31}
32
33TEST_P(olWaitEventTest, InvalidNullEvent) {
34 ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, olWaitEvent(nullptr));
35}
36

source code of offload/unittests/OffloadAPI/event/olWaitEvent.cpp