llvm-project/offload/unittests/OffloadAPI/event/olGetEventInfoSize.cpp
Callum Fare 7c6edf4a05
[Offload] Implement olGetQueueInfo, olGetEventInfo (#142947)
Add info queries for queues and events.

`olGetQueueInfo` only supports getting the associated device. We were
already tracking this so we can implement this for free. We will likely
add other queries to it in the future (whether the queue is empty, what
flags it was created with, etc)

`olGetEventInfo` only supports getting the associated queue. This is
another thing we were already storing in the handle. We'll be able to
add other queries in future (the event type, status, etc)
2025-07-09 17:09:31 +01:00

38 lines
1.3 KiB
C++

//===------- Offload API tests - olGetEventInfoSize -----------------------===//
//
// 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 olGetEventInfoSizeTest = OffloadEventTest;
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olGetEventInfoSizeTest);
TEST_P(olGetEventInfoSizeTest, SuccessQueue) {
size_t Size = 0;
ASSERT_SUCCESS(olGetEventInfoSize(Event, OL_EVENT_INFO_QUEUE, &Size));
ASSERT_EQ(Size, sizeof(ol_queue_handle_t));
}
TEST_P(olGetEventInfoSizeTest, InvalidNullHandle) {
size_t Size = 0;
ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE,
olGetEventInfoSize(nullptr, OL_EVENT_INFO_QUEUE, &Size));
}
TEST_P(olGetEventInfoSizeTest, InvalidEventInfoEnumeration) {
size_t Size = 0;
ASSERT_ERROR(OL_ERRC_INVALID_ENUMERATION,
olGetEventInfoSize(Event, OL_EVENT_INFO_FORCE_UINT32, &Size));
}
TEST_P(olGetEventInfoSizeTest, InvalidNullPointer) {
ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER,
olGetEventInfoSize(Event, OL_EVENT_INFO_QUEUE, nullptr));
}