aboutsummaryrefslogtreecommitdiff
path: root/offload/unittests/OffloadAPI/event/olGetEventInfo.cpp
blob: 908d2dcb6df5deede0ed32b8f89514cf574270e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//===------- Offload API tests - olGetEventInfo ---------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <OffloadAPI.h>

#include "../common/Fixtures.hpp"

using olGetEventInfoTest = OffloadEventTest;
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olGetEventInfoTest);

TEST_P(olGetEventInfoTest, SuccessDevice) {
  ol_queue_handle_t RetrievedQueue;
  ASSERT_SUCCESS(olGetEventInfo(Event, OL_EVENT_INFO_QUEUE,
                                sizeof(ol_queue_handle_t), &RetrievedQueue));
  ASSERT_EQ(Queue, RetrievedQueue);
}

TEST_P(olGetEventInfoTest, InvalidNullHandle) {
  ol_queue_handle_t RetrievedQueue;
  ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE,
               olGetEventInfo(nullptr, OL_EVENT_INFO_QUEUE,
                              sizeof(RetrievedQueue), &RetrievedQueue));
}

TEST_P(olGetEventInfoTest, InvalidEventInfoEnumeration) {
  ol_queue_handle_t RetrievedQueue;
  ASSERT_ERROR(OL_ERRC_INVALID_ENUMERATION,
               olGetEventInfo(Event, OL_EVENT_INFO_FORCE_UINT32,
                              sizeof(RetrievedQueue), &RetrievedQueue));
}

TEST_P(olGetEventInfoTest, InvalidSizeZero) {
  ol_queue_handle_t RetrievedQueue;
  ASSERT_ERROR(OL_ERRC_INVALID_SIZE,
               olGetEventInfo(Event, OL_EVENT_INFO_QUEUE, 0, &RetrievedQueue));
}

TEST_P(olGetEventInfoTest, InvalidSizeSmall) {
  ol_queue_handle_t RetrievedQueue;
  ASSERT_ERROR(OL_ERRC_INVALID_SIZE,
               olGetEventInfo(Event, OL_EVENT_INFO_QUEUE,
                              sizeof(RetrievedQueue) - 1, &RetrievedQueue));
}

TEST_P(olGetEventInfoTest, InvalidNullPointerPropValue) {
  ol_queue_handle_t RetrievedQueue;
  ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER,
               olGetEventInfo(Event, OL_EVENT_INFO_QUEUE,
                              sizeof(RetrievedQueue), nullptr));
}