| 1 |
//===------- Offload API tests - olGetEventInfo ---------------------------===// |
| 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 <OffloadAPI.h> |
| 10 |
|
| 11 |
#include "../common/Fixtures.hpp" |
| 12 |
|
| 13 |
using olGetEventInfoTest = OffloadEventTest; |
| 14 |
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olGetEventInfoTest); |
| 15 |
|
| 16 |
TEST_P(olGetEventInfoTest, SuccessQueue) { |
| 17 |
ol_queue_handle_t RetrievedQueue; |
| 18 |
ASSERT_SUCCESS(olGetEventInfo(Event, OL_EVENT_INFO_QUEUE, |
| 19 |
sizeof(ol_queue_handle_t), &RetrievedQueue)); |
| 20 |
ASSERT_EQ(Queue, RetrievedQueue); |
| 21 |
} |
| 22 |
|
| 23 |
TEST_P(olGetEventInfoTest, SuccessIsComplete) { |
| 24 |
bool Complete = false; |
| 25 |
while (!Complete) { |
| 26 |
ASSERT_SUCCESS(olGetEventInfo(Event, OL_EVENT_INFO_IS_COMPLETE, |
| 27 |
sizeof(Complete), &Complete)); |
| 28 |
} |
| 29 |
ASSERT_EQ(Complete, true); |
| 30 |
} |
| 31 |
|
| 32 |
TEST_P(olGetEventInfoTest, InvalidNullHandle) { |
| 33 |
ol_queue_handle_t RetrievedQueue; |
| 34 |
ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, |
| 35 |
olGetEventInfo(nullptr, OL_EVENT_INFO_QUEUE, |
| 36 |
sizeof(RetrievedQueue), &RetrievedQueue)); |
| 37 |
} |
| 38 |
|
| 39 |
TEST_P(olGetEventInfoTest, InvalidEventInfoEnumeration) { |
| 40 |
ol_queue_handle_t RetrievedQueue; |
| 41 |
ASSERT_ERROR(OL_ERRC_INVALID_ENUMERATION, |
| 42 |
olGetEventInfo(Event, OL_EVENT_INFO_FORCE_UINT32, |
| 43 |
sizeof(RetrievedQueue), &RetrievedQueue)); |
| 44 |
} |
| 45 |
|
| 46 |
TEST_P(olGetEventInfoTest, InvalidSizeZero) { |
| 47 |
ol_queue_handle_t RetrievedQueue; |
| 48 |
ASSERT_ERROR(OL_ERRC_INVALID_SIZE, |
| 49 |
olGetEventInfo(Event, OL_EVENT_INFO_QUEUE, 0, &RetrievedQueue)); |
| 50 |
} |
| 51 |
|
| 52 |
TEST_P(olGetEventInfoTest, InvalidSizeSmall) { |
| 53 |
ol_queue_handle_t RetrievedQueue; |
| 54 |
ASSERT_ERROR(OL_ERRC_INVALID_SIZE, |
| 55 |
olGetEventInfo(Event, OL_EVENT_INFO_QUEUE, |
| 56 |
sizeof(RetrievedQueue) - 1, &RetrievedQueue)); |
| 57 |
} |
| 58 |
|
| 59 |
TEST_P(olGetEventInfoTest, InvalidNullPointerPropValue) { |
| 60 |
ol_queue_handle_t RetrievedQueue; |
| 61 |
ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER, |
| 62 |
olGetEventInfo(Event, OL_EVENT_INFO_QUEUE, |
| 63 |
sizeof(RetrievedQueue), nullptr)); |
| 64 |
} |