5
5
6
6
#include " fixtures.h"
7
7
8
- using urEventGetInfoTest = uur::event::urEventTestWithParam< ur_event_info_t > ;
8
+ using urEventGetInfoTest = uur::event::urEventTest ;
9
9
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 ;
11
13
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));
16
15
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;
18
34
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);
59
38
}
60
39
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 ) );
68
47
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
+ }
70
84
71
- TEST_P (urEventGetInfoNegativeTest , InvalidNullHandle) {
85
+ TEST_P (urEventGetInfoTest , InvalidNullHandle) {
72
86
ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_QUEUE;
73
87
size_t size;
74
88
ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
@@ -81,14 +95,14 @@ TEST_P(urEventGetInfoNegativeTest, InvalidNullHandle) {
81
95
UR_RESULT_ERROR_INVALID_NULL_HANDLE);
82
96
}
83
97
84
- TEST_P (urEventGetInfoNegativeTest , InvalidEnumeration) {
98
+ TEST_P (urEventGetInfoTest , InvalidEnumeration) {
85
99
size_t size;
86
100
ASSERT_EQ_RESULT (
87
101
urEventGetInfo (event, UR_EVENT_INFO_FORCE_UINT32, 0 , nullptr , &size),
88
102
UR_RESULT_ERROR_INVALID_ENUMERATION);
89
103
}
90
104
91
- TEST_P (urEventGetInfoNegativeTest , InvalidSizePropSize) {
105
+ TEST_P (urEventGetInfoTest , InvalidSizePropSize) {
92
106
ur_event_info_t info_type = UR_EVENT_INFO_COMMAND_QUEUE;
93
107
size_t size = 0 ;
94
108
ASSERT_SUCCESS (urEventGetInfo (event, info_type, 0 , nullptr , &size));
@@ -101,24 +115,24 @@ TEST_P(urEventGetInfoNegativeTest, InvalidSizePropSize) {
101
115
UR_RESULT_ERROR_INVALID_SIZE);
102
116
}
103
117
104
- TEST_P (urEventGetInfoNegativeTest , InvalidSizePropSizeSmall) {
118
+ TEST_P (urEventGetInfoTest , InvalidSizePropSizeSmall) {
105
119
ur_queue_handle_t q;
106
120
ASSERT_EQ_RESULT (urEventGetInfo (event, UR_EVENT_INFO_COMMAND_QUEUE,
107
121
sizeof (q) - 1 , &q, nullptr ),
108
122
UR_RESULT_ERROR_INVALID_SIZE);
109
123
}
110
124
111
- TEST_P (urEventGetInfoNegativeTest , InvalidNullPointerPropValue) {
125
+ TEST_P (urEventGetInfoTest , InvalidNullPointerPropValue) {
112
126
ASSERT_EQ_RESULT (urEventGetInfo (event, UR_EVENT_INFO_COMMAND_QUEUE,
113
127
sizeof (ur_queue_handle_t ), nullptr ,
114
128
nullptr ),
115
129
UR_RESULT_ERROR_INVALID_NULL_POINTER);
116
130
}
117
131
118
- TEST_P (urEventGetInfoNegativeTest , InvalidNullPointerPropSizeRet) {
132
+ TEST_P (urEventGetInfoTest , InvalidNullPointerPropSizeRet) {
119
133
ASSERT_EQ_RESULT (
120
134
urEventGetInfo (event, UR_EVENT_INFO_COMMAND_QUEUE, 0 , nullptr , nullptr ),
121
135
UR_RESULT_ERROR_INVALID_NULL_POINTER);
122
136
}
123
137
124
- UUR_INSTANTIATE_DEVICE_TEST_SUITE_P (urEventGetInfoNegativeTest );
138
+ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P (urEventGetInfoTest );
0 commit comments