| 1 |
//===------- Offload API tests - olGetQueueInfo ---------------------------===// |
| 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 olGetQueueInfoTest = OffloadQueueTest; |
| 14 |
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olGetQueueInfoTest); |
| 15 |
|
| 16 |
TEST_P(olGetQueueInfoTest, SuccessDevice) { |
| 17 |
ol_device_handle_t RetrievedDevice; |
| 18 |
ASSERT_SUCCESS(olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE, |
| 19 |
sizeof(ol_device_handle_t), &RetrievedDevice)); |
| 20 |
ASSERT_EQ(Device, RetrievedDevice); |
| 21 |
} |
| 22 |
|
| 23 |
TEST_P(olGetQueueInfoTest, SuccessEmpty) { |
| 24 |
bool Empty; |
| 25 |
ASSERT_SUCCESS( |
| 26 |
olGetQueueInfo(Queue, OL_QUEUE_INFO_EMPTY, sizeof(Empty), &Empty)); |
| 27 |
} |
| 28 |
|
| 29 |
TEST_P(olGetQueueInfoTest, InvalidNullHandle) { |
| 30 |
ol_device_handle_t RetrievedDevice; |
| 31 |
ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, |
| 32 |
olGetQueueInfo(nullptr, OL_QUEUE_INFO_DEVICE, |
| 33 |
sizeof(RetrievedDevice), &RetrievedDevice)); |
| 34 |
} |
| 35 |
|
| 36 |
TEST_P(olGetQueueInfoTest, InvalidQueueInfoEnumeration) { |
| 37 |
ol_device_handle_t RetrievedDevice; |
| 38 |
ASSERT_ERROR(OL_ERRC_INVALID_ENUMERATION, |
| 39 |
olGetQueueInfo(Queue, OL_QUEUE_INFO_FORCE_UINT32, |
| 40 |
sizeof(RetrievedDevice), &RetrievedDevice)); |
| 41 |
} |
| 42 |
|
| 43 |
TEST_P(olGetQueueInfoTest, InvalidSizeZero) { |
| 44 |
ol_device_handle_t RetrievedDevice; |
| 45 |
ASSERT_ERROR(OL_ERRC_INVALID_SIZE, olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE, |
| 46 |
0, &RetrievedDevice)); |
| 47 |
} |
| 48 |
|
| 49 |
TEST_P(olGetQueueInfoTest, InvalidSizeSmall) { |
| 50 |
ol_device_handle_t RetrievedDevice; |
| 51 |
ASSERT_ERROR(OL_ERRC_INVALID_SIZE, |
| 52 |
olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE, |
| 53 |
sizeof(RetrievedDevice) - 1, &RetrievedDevice)); |
| 54 |
} |
| 55 |
|
| 56 |
TEST_P(olGetQueueInfoTest, InvalidNullPointerPropValue) { |
| 57 |
ol_device_handle_t RetrievedDevice; |
| 58 |
ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER, |
| 59 |
olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE, |
| 60 |
sizeof(RetrievedDevice), nullptr)); |
| 61 |
} |