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
13using olGetQueueInfoTest = OffloadQueueTest;
14OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olGetQueueInfoTest);
15
16TEST_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
23TEST_P(olGetQueueInfoTest, InvalidNullHandle) {
24 ol_device_handle_t RetrievedDevice;
25 ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE,
26 olGetQueueInfo(nullptr, OL_QUEUE_INFO_DEVICE,
27 sizeof(RetrievedDevice), &RetrievedDevice));
28}
29
30TEST_P(olGetQueueInfoTest, InvalidQueueInfoEnumeration) {
31 ol_device_handle_t RetrievedDevice;
32 ASSERT_ERROR(OL_ERRC_INVALID_ENUMERATION,
33 olGetQueueInfo(Queue, OL_QUEUE_INFO_FORCE_UINT32,
34 sizeof(RetrievedDevice), &RetrievedDevice));
35}
36
37TEST_P(olGetQueueInfoTest, InvalidSizeZero) {
38 ol_device_handle_t RetrievedDevice;
39 ASSERT_ERROR(OL_ERRC_INVALID_SIZE, olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE,
40 0, &RetrievedDevice));
41}
42
43TEST_P(olGetQueueInfoTest, InvalidSizeSmall) {
44 ol_device_handle_t RetrievedDevice;
45 ASSERT_ERROR(OL_ERRC_INVALID_SIZE,
46 olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE,
47 sizeof(RetrievedDevice) - 1, &RetrievedDevice));
48}
49
50TEST_P(olGetQueueInfoTest, InvalidNullPointerPropValue) {
51 ol_device_handle_t RetrievedDevice;
52 ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER,
53 olGetQueueInfo(Queue, OL_QUEUE_INFO_DEVICE,
54 sizeof(RetrievedDevice), nullptr));
55}
56

source code of offload/unittests/OffloadAPI/queue/olGetQueueInfo.cpp