55
66#include " fixtures.h"
77
8- using urEventGetInfoTest = uur::event::urEventTestWithParam< ur_event_info_t > ;
8+ using urEventGetInfoTest = uur::event::urEventTest ;
99
10- TEST_P (urEventGetInfoTest, Success) {
10+ TEST_P (urEventGetInfoTest, SuccessCommandQueue) {
11+ ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_QUEUE;
12+ size_t size = 0 ;
1113
12- ur_event_info_t info_type = getParam ();
13- size_t size;
14- ASSERT_SUCCESS_OR_OPTIONAL_QUERY (
15- urEventGetInfo (event, info_type, 0 , nullptr , &size), info_type);
14+ ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
1615 ASSERT_NE (size, 0 );
17- std::vector<uint8_t > data (size);
16+ ASSERT_EQ (size, sizeof (ur_queue_handle_t ));
17+
18+ ur_queue_handle_t returned_queue;
19+ ASSERT_SUCCESS (
20+ urEventGetInfo (event, info_type, size, &returned_queue, nullptr ));
21+
22+ ASSERT_EQ (queue, returned_queue);
23+ }
24+
25+ TEST_P (urEventGetInfoTest, SuccessContext) {
26+ ur_event_info_t info_type = UR_EVENT_INFO_CONTEXT;
27+ size_t size = 0 ;
28+
29+ ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
30+ ASSERT_NE (size, 0 );
31+ ASSERT_EQ (size, sizeof (ur_context_handle_t ));
32+
33+ ur_context_handle_t returned_context;
1834 ASSERT_SUCCESS (
19- urEventGetInfo (event, info_type, size, data.data (), nullptr ));
20-
21- switch (info_type) {
22- case UR_EVENT_INFO_COMMAND_QUEUE: {
23- ASSERT_EQ (sizeof (ur_queue_handle_t ), size);
24- auto returned_queue =
25- reinterpret_cast <ur_queue_handle_t *>(data.data ());
26- ASSERT_EQ (queue, *returned_queue);
27- break ;
28- }
29- case UR_EVENT_INFO_CONTEXT: {
30- ASSERT_EQ (sizeof (ur_context_handle_t ), size);
31- auto returned_context =
32- reinterpret_cast <ur_context_handle_t *>(data.data ());
33- ASSERT_EQ (context, *returned_context);
34- break ;
35- }
36- case UR_EVENT_INFO_COMMAND_TYPE: {
37- ASSERT_EQ (sizeof (ur_command_t ), size);
38- auto returned_command = reinterpret_cast <ur_command_t *>(data.data ());
39- ASSERT_EQ (UR_COMMAND_MEM_BUFFER_WRITE, *returned_command);
40- break ;
41- }
42- case UR_EVENT_INFO_COMMAND_EXECUTION_STATUS: {
43- ASSERT_EQ (sizeof (ur_event_status_t ), size);
44- auto returned_status =
45- reinterpret_cast <ur_event_status_t *>(data.data ());
46- ASSERT_EQ (UR_EVENT_STATUS_COMPLETE, *returned_status);
47- break ;
48- }
49- case UR_EVENT_INFO_REFERENCE_COUNT: {
50- ASSERT_EQ (sizeof (uint32_t ), size);
51- auto returned_reference_count =
52- reinterpret_cast <uint32_t *>(data.data ());
53- ASSERT_GT (*returned_reference_count, 0U );
54- break ;
55- }
56- default :
57- FAIL () << " Invalid event info enumeration" ;
58- }
35+ urEventGetInfo (event, info_type, size, &returned_context, nullptr ));
36+
37+ ASSERT_EQ (context, returned_context);
5938}
6039
61- UUR_TEST_SUITE_P (urEventGetInfoTest,
62- ::testing::Values (UR_EVENT_INFO_COMMAND_QUEUE,
63- UR_EVENT_INFO_CONTEXT,
64- UR_EVENT_INFO_COMMAND_TYPE,
65- UR_EVENT_INFO_COMMAND_EXECUTION_STATUS,
66- UR_EVENT_INFO_REFERENCE_COUNT),
67- uur::deviceTestWithParamPrinter<ur_event_info_t> );
40+ TEST_P (urEventGetInfoTest, SuccessCommandType) {
41+ ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_TYPE;
42+ size_t size = 0 ;
43+
44+ ASSERT_SUCCESS ( urEventGetInfo (event, info_type, 0 , nullptr , &size));
45+ ASSERT_NE (size, 0 );
46+ ASSERT_EQ (size, sizeof ( ur_command_t ) );
6847
69- using urEventGetInfoNegativeTest = uur::event::urEventTest;
48+ ur_command_t returned_command_type;
49+ ASSERT_SUCCESS (urEventGetInfo (event, info_type, size,
50+ &returned_command_type, nullptr ));
51+
52+ ASSERT_EQ (UR_COMMAND_MEM_BUFFER_WRITE, returned_command_type);
53+ }
54+
55+ TEST_P (urEventGetInfoTest, SuccessCommandExecutionStatus) {
56+ ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_EXECUTION_STATUS;
57+ size_t size = 0 ;
58+
59+ ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
60+ ASSERT_NE (size, 0 );
61+ ASSERT_EQ (size, sizeof (ur_event_status_t ));
62+
63+ ur_event_status_t returned_status;
64+ ASSERT_SUCCESS (
65+ urEventGetInfo (event, info_type, size, &returned_status, nullptr ));
66+
67+ ASSERT_EQ (UR_EVENT_STATUS_COMPLETE, returned_status);
68+ }
69+
70+ TEST_P (urEventGetInfoTest, SuccessReferenceCount) {
71+ ur_event_info_t info_type = UR_EVENT_INFO_REFERENCE_COUNT;
72+ size_t size = 0 ;
73+
74+ ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
75+ ASSERT_NE (size, 0 );
76+ ASSERT_EQ (size, sizeof (uint32_t ));
77+
78+ uint32_t returned_reference_count;
79+ ASSERT_SUCCESS (urEventGetInfo (event, info_type, size,
80+ &returned_reference_count, nullptr ));
81+
82+ ASSERT_GT (returned_reference_count, 0U );
83+ }
7084
71- TEST_P (urEventGetInfoNegativeTest , InvalidNullHandle) {
85+ TEST_P (urEventGetInfoTest , InvalidNullHandle) {
7286 ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_QUEUE;
7387 size_t size;
7488 ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
@@ -81,14 +95,14 @@ TEST_P(urEventGetInfoNegativeTest, InvalidNullHandle) {
8195 UR_RESULT_ERROR_INVALID_NULL_HANDLE);
8296}
8397
84- TEST_P (urEventGetInfoNegativeTest , InvalidEnumeration) {
98+ TEST_P (urEventGetInfoTest , InvalidEnumeration) {
8599 size_t size;
86100 ASSERT_EQ_RESULT (
87101 urEventGetInfo (event, UR_EVENT_INFO_FORCE_UINT32, 0 , nullptr , &size),
88102 UR_RESULT_ERROR_INVALID_ENUMERATION);
89103}
90104
91- TEST_P (urEventGetInfoNegativeTest , InvalidSizePropSize) {
105+ TEST_P (urEventGetInfoTest , InvalidSizePropSize) {
92106 ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_QUEUE;
93107 size_t size = 0 ;
94108 ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
@@ -101,24 +115,24 @@ TEST_P(urEventGetInfoNegativeTest, InvalidSizePropSize) {
101115 UR_RESULT_ERROR_INVALID_SIZE);
102116}
103117
104- TEST_P (urEventGetInfoNegativeTest , InvalidSizePropSizeSmall) {
118+ TEST_P (urEventGetInfoTest , InvalidSizePropSizeSmall) {
105119 ur_queue_handle_t q;
106120 ASSERT_EQ_RESULT (urEventGetInfo (event, UR_EVENT_INFO_COMMAND_QUEUE,
107121 sizeof (q) - 1 , &q, nullptr ),
108122 UR_RESULT_ERROR_INVALID_SIZE);
109123}
110124
111- TEST_P (urEventGetInfoNegativeTest , InvalidNullPointerPropValue) {
125+ TEST_P (urEventGetInfoTest , InvalidNullPointerPropValue) {
112126 ASSERT_EQ_RESULT (urEventGetInfo (event, UR_EVENT_INFO_COMMAND_QUEUE,
113127 sizeof (ur_queue_handle_t ), nullptr ,
114128 nullptr ),
115129 UR_RESULT_ERROR_INVALID_NULL_POINTER);
116130}
117131
118- TEST_P (urEventGetInfoNegativeTest , InvalidNullPointerPropSizeRet) {
132+ TEST_P (urEventGetInfoTest , InvalidNullPointerPropSizeRet) {
119133 ASSERT_EQ_RESULT (
120134 urEventGetInfo (event, UR_EVENT_INFO_COMMAND_QUEUE, 0 , nullptr , nullptr ),
121135 UR_RESULT_ERROR_INVALID_NULL_POINTER);
122136}
123137
124- UUR_INSTANTIATE_DEVICE_TEST_SUITE_P (urEventGetInfoNegativeTest );
138+ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P (urEventGetInfoTest );
0 commit comments