1/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15
16#include <my_global.h>
17#include <my_pthread.h>
18#include <pfs_instr.h>
19#include <pfs_stat.h>
20#include <pfs_global.h>
21#include <pfs_instr_class.h>
22#include <tap.h>
23
24#include "stub_pfs_global.h"
25
26#include <string.h> /* memset */
27
28void test_oom()
29{
30 int rc;
31 PFS_global_param param;
32
33 stub_alloc_always_fails= true;
34
35 memset(& param, 0xFF, sizeof(param));
36 param.m_enabled= true;
37 param.m_mutex_class_sizing= 10;
38 param.m_rwlock_class_sizing= 0;
39 param.m_cond_class_sizing= 0;
40 param.m_thread_class_sizing= 0;
41 param.m_table_share_sizing= 0;
42 param.m_file_class_sizing= 0;
43 param.m_socket_class_sizing= 0;
44 param.m_mutex_sizing= 1000;
45 param.m_rwlock_sizing= 0;
46 param.m_cond_sizing= 0;
47 param.m_thread_sizing= 0;
48 param.m_table_sizing= 0;
49 param.m_file_sizing= 0;
50 param.m_file_handle_sizing= 0;
51 param.m_socket_sizing= 0;
52 param.m_events_waits_history_sizing= 0;
53 param.m_events_waits_history_long_sizing= 0;
54 param.m_setup_actor_sizing= 0;
55 param.m_setup_object_sizing= 0;
56 param.m_host_sizing= 0;
57 param.m_user_sizing= 0;
58 param.m_account_sizing= 0;
59 param.m_stage_class_sizing= 0;
60 param.m_events_stages_history_sizing= 0;
61 param.m_events_stages_history_long_sizing= 0;
62 param.m_statement_class_sizing= 0;
63 param.m_events_statements_history_sizing= 0;
64 param.m_events_statements_history_long_sizing= 0;
65 param.m_session_connect_attrs_sizing= 0;
66
67 init_event_name_sizing(& param);
68 rc= init_instruments(& param);
69 ok(rc == 1, "oom (mutex)");
70 cleanup_instruments();
71
72 param.m_enabled= true;
73 param.m_mutex_class_sizing= 0;
74 param.m_rwlock_class_sizing= 10;
75 param.m_cond_class_sizing= 0;
76 param.m_thread_class_sizing= 0;
77 param.m_table_share_sizing= 0;
78 param.m_file_class_sizing= 0;
79 param.m_socket_class_sizing= 0;
80 param.m_mutex_sizing= 0;
81 param.m_rwlock_sizing= 1000;
82 param.m_cond_sizing= 0;
83 param.m_thread_sizing= 0;
84 param.m_table_sizing= 0;
85 param.m_file_sizing= 0;
86 param.m_file_handle_sizing= 0;
87 param.m_socket_sizing= 0;
88 param.m_events_waits_history_sizing= 0;
89 param.m_events_waits_history_long_sizing= 0;
90 param.m_setup_actor_sizing= 0;
91 param.m_setup_object_sizing= 0;
92 param.m_host_sizing= 0;
93 param.m_user_sizing= 0;
94 param.m_account_sizing= 0;
95 param.m_stage_class_sizing= 0;
96 param.m_events_stages_history_sizing= 0;
97 param.m_events_stages_history_long_sizing= 0;
98 param.m_statement_class_sizing= 0;
99 param.m_events_statements_history_sizing= 0;
100 param.m_events_statements_history_long_sizing= 0;
101 param.m_session_connect_attrs_sizing= 0;
102
103 init_event_name_sizing(& param);
104 rc= init_instruments(& param);
105 ok(rc == 1, "oom (rwlock)");
106 cleanup_instruments();
107
108 param.m_enabled= true;
109 param.m_mutex_class_sizing= 0;
110 param.m_rwlock_class_sizing= 0;
111 param.m_cond_class_sizing= 10;
112 param.m_thread_class_sizing= 0;
113 param.m_table_share_sizing= 0;
114 param.m_file_class_sizing= 0;
115 param.m_socket_class_sizing= 0;
116 param.m_mutex_sizing= 0;
117 param.m_rwlock_sizing= 0;
118 param.m_cond_sizing= 1000;
119 param.m_thread_sizing= 0;
120 param.m_table_sizing= 0;
121 param.m_file_sizing= 0;
122 param.m_file_handle_sizing= 0;
123 param.m_socket_sizing= 0;
124 param.m_events_waits_history_sizing= 0;
125 param.m_events_waits_history_long_sizing= 0;
126 param.m_setup_actor_sizing= 0;
127 param.m_setup_object_sizing= 0;
128 param.m_host_sizing= 0;
129 param.m_user_sizing= 0;
130 param.m_account_sizing= 0;
131 param.m_stage_class_sizing= 0;
132 param.m_events_stages_history_sizing= 0;
133 param.m_events_stages_history_long_sizing= 0;
134 param.m_statement_class_sizing= 0;
135 param.m_events_statements_history_sizing= 0;
136 param.m_events_statements_history_long_sizing= 0;
137 param.m_session_connect_attrs_sizing= 0;
138
139 init_event_name_sizing(& param);
140 rc= init_instruments(& param);
141 ok(rc == 1, "oom (cond)");
142 cleanup_instruments();
143
144 param.m_enabled= true;
145 param.m_mutex_class_sizing= 0;
146 param.m_rwlock_class_sizing= 0;
147 param.m_cond_class_sizing= 0;
148 param.m_thread_class_sizing= 0;
149 param.m_table_share_sizing= 0;
150 param.m_file_class_sizing= 10;
151 param.m_socket_class_sizing= 0;
152 param.m_mutex_sizing= 0;
153 param.m_rwlock_sizing= 0;
154 param.m_cond_sizing= 0;
155 param.m_thread_sizing= 0;
156 param.m_table_sizing= 0;
157 param.m_file_sizing= 1000;
158 param.m_file_handle_sizing= 1000;
159 param.m_socket_sizing= 0;
160 param.m_events_waits_history_sizing= 0;
161 param.m_events_waits_history_long_sizing= 0;
162 param.m_setup_actor_sizing= 0;
163 param.m_setup_object_sizing= 0;
164 param.m_host_sizing= 0;
165 param.m_user_sizing= 0;
166 param.m_account_sizing= 0;
167 param.m_stage_class_sizing= 0;
168 param.m_events_stages_history_sizing= 0;
169 param.m_events_stages_history_long_sizing= 0;
170 param.m_statement_class_sizing= 0;
171 param.m_events_statements_history_sizing= 0;
172 param.m_events_statements_history_long_sizing= 0;
173 param.m_session_connect_attrs_sizing= 0;
174
175 init_event_name_sizing(& param);
176 rc= init_instruments(& param);
177 ok(rc == 1, "oom (file)");
178 cleanup_instruments();
179
180 param.m_enabled= true;
181 param.m_mutex_class_sizing= 0;
182 param.m_rwlock_class_sizing= 0;
183 param.m_cond_class_sizing= 0;
184 param.m_thread_class_sizing= 0;
185 param.m_table_share_sizing= 0;
186 param.m_file_class_sizing= 0;
187 param.m_mutex_sizing= 0;
188 param.m_rwlock_sizing= 0;
189 param.m_cond_sizing= 0;
190 param.m_thread_sizing= 0;
191 param.m_table_sizing= 0;
192 param.m_file_sizing= 0;
193 param.m_file_handle_sizing= 1000;
194 param.m_events_waits_history_sizing= 0;
195 param.m_events_waits_history_long_sizing= 0;
196 param.m_setup_actor_sizing= 0;
197 param.m_setup_object_sizing= 0;
198 param.m_host_sizing= 0;
199 param.m_user_sizing= 0;
200 param.m_account_sizing= 0;
201 param.m_stage_class_sizing= 0;
202 param.m_events_stages_history_sizing= 0;
203 param.m_events_stages_history_long_sizing= 0;
204 param.m_statement_class_sizing= 0;
205 param.m_events_statements_history_sizing= 0;
206 param.m_events_statements_history_long_sizing= 0;
207 param.m_session_connect_attrs_sizing= 0;
208
209 init_event_name_sizing(& param);
210 rc= init_instruments(& param);
211 ok(rc == 1, "oom (file handle)");
212 cleanup_instruments();
213
214 param.m_enabled= true;
215 param.m_mutex_class_sizing= 0;
216 param.m_rwlock_class_sizing= 0;
217 param.m_cond_class_sizing= 0;
218 param.m_thread_class_sizing= 0;
219 param.m_table_share_sizing= 10;
220 param.m_file_class_sizing= 0;
221 param.m_socket_class_sizing= 0;
222 param.m_mutex_sizing= 0;
223 param.m_rwlock_sizing= 0;
224 param.m_cond_sizing= 0;
225 param.m_thread_sizing= 0;
226 param.m_table_sizing= 1000;
227 param.m_file_sizing= 0;
228 param.m_file_handle_sizing= 0;
229 param.m_socket_sizing= 0;
230 param.m_events_waits_history_sizing= 0;
231 param.m_events_waits_history_long_sizing= 0;
232 param.m_setup_actor_sizing= 0;
233 param.m_setup_object_sizing= 0;
234 param.m_host_sizing= 0;
235 param.m_user_sizing= 0;
236 param.m_account_sizing= 0;
237 param.m_stage_class_sizing= 0;
238 param.m_events_stages_history_sizing= 0;
239 param.m_events_stages_history_long_sizing= 0;
240 param.m_statement_class_sizing= 0;
241 param.m_events_statements_history_sizing= 0;
242 param.m_events_statements_history_long_sizing= 0;
243 param.m_session_connect_attrs_sizing= 0;
244
245 init_event_name_sizing(& param);
246 rc= init_instruments(& param);
247 ok(rc == 1, "oom (table)");
248 cleanup_instruments();
249
250 param.m_enabled= true;
251 param.m_mutex_class_sizing= 0;
252 param.m_rwlock_class_sizing= 0;
253 param.m_cond_class_sizing= 0;
254 param.m_thread_class_sizing= 10;
255 param.m_table_share_sizing= 0;
256 param.m_file_class_sizing= 0;
257 param.m_socket_class_sizing= 0;
258 param.m_mutex_sizing= 0;
259 param.m_rwlock_sizing= 0;
260 param.m_cond_sizing= 0;
261 param.m_thread_sizing= 1000;
262 param.m_table_sizing= 0;
263 param.m_file_sizing= 0;
264 param.m_file_handle_sizing= 0;
265 param.m_socket_sizing= 0;
266 param.m_events_waits_history_sizing= 0;
267 param.m_events_waits_history_long_sizing= 0;
268 param.m_setup_actor_sizing= 0;
269 param.m_setup_object_sizing= 0;
270 param.m_host_sizing= 0;
271 param.m_user_sizing= 0;
272 param.m_account_sizing= 0;
273 param.m_stage_class_sizing= 0;
274 param.m_events_stages_history_sizing= 0;
275 param.m_events_stages_history_long_sizing= 0;
276 param.m_statement_class_sizing= 0;
277 param.m_events_statements_history_sizing= 0;
278 param.m_events_statements_history_long_sizing= 0;
279 param.m_session_connect_attrs_sizing= 0;
280
281 init_event_name_sizing(& param);
282 rc= init_instruments(& param);
283 ok(rc == 1, "oom (thread)");
284 cleanup_instruments();
285
286 stub_alloc_always_fails= false;
287
288 param.m_enabled= true;
289 param.m_mutex_class_sizing= 0;
290 param.m_rwlock_class_sizing= 0;
291 param.m_cond_class_sizing= 0;
292 param.m_thread_class_sizing= 10;
293 param.m_table_share_sizing= 0;
294 param.m_file_class_sizing= 0;
295 param.m_socket_class_sizing= 0;
296 param.m_mutex_sizing= 0;
297 param.m_rwlock_sizing= 0;
298 param.m_cond_sizing= 0;
299 param.m_thread_sizing= 1000;
300 param.m_table_sizing= 0;
301 param.m_file_sizing= 0;
302 param.m_file_handle_sizing= 0;
303 param.m_socket_sizing= 0;
304 param.m_events_waits_history_sizing= 10;
305 param.m_events_waits_history_long_sizing= 0;
306 param.m_setup_actor_sizing= 0;
307 param.m_setup_object_sizing= 0;
308 param.m_host_sizing= 0;
309 param.m_user_sizing= 0;
310 param.m_account_sizing= 0;
311 param.m_stage_class_sizing= 0;
312 param.m_events_stages_history_sizing= 0;
313 param.m_events_stages_history_long_sizing= 0;
314 param.m_statement_class_sizing= 0;
315 param.m_events_statements_history_sizing= 0;
316 param.m_events_statements_history_long_sizing= 0;
317 param.m_session_connect_attrs_sizing= 0;
318
319 stub_alloc_fails_after_count= 2;
320 init_event_name_sizing(& param);
321 rc= init_instruments(& param);
322 ok(rc == 1, "oom (thread waits history sizing)");
323 cleanup_instruments();
324
325 param.m_enabled= true;
326 param.m_mutex_class_sizing= 50;
327 param.m_rwlock_class_sizing= 50;
328 param.m_cond_class_sizing= 50;
329 param.m_thread_class_sizing= 10;
330 param.m_table_share_sizing= 0;
331 param.m_file_class_sizing= 50;
332 param.m_socket_class_sizing= 0;
333 param.m_mutex_sizing= 0;
334 param.m_rwlock_sizing= 0;
335 param.m_cond_sizing= 0;
336 param.m_thread_sizing= 1000;
337 param.m_table_sizing= 0;
338 param.m_file_sizing= 0;
339 param.m_file_handle_sizing= 0;
340 param.m_socket_sizing= 0;
341 param.m_events_waits_history_sizing= 0;
342 param.m_events_waits_history_long_sizing= 0;
343 param.m_setup_actor_sizing= 0;
344 param.m_setup_object_sizing= 0;
345 param.m_stage_class_sizing= 0;
346 param.m_events_stages_history_sizing= 0;
347 param.m_events_stages_history_long_sizing= 0;
348 param.m_statement_class_sizing= 0;
349 param.m_events_statements_history_sizing= 0;
350 param.m_events_statements_history_long_sizing= 0;
351 param.m_session_connect_attrs_sizing= 0;
352
353 stub_alloc_fails_after_count= 2;
354 init_event_name_sizing(& param);
355 rc= init_instruments(& param);
356 ok(rc == 1, "oom (per thread wait)");
357
358 cleanup_sync_class();
359 cleanup_thread_class();
360 cleanup_file_class();
361 cleanup_instruments();
362
363 param.m_enabled= true;
364 param.m_mutex_class_sizing= 0;
365 param.m_rwlock_class_sizing= 0;
366 param.m_cond_class_sizing= 0;
367 param.m_thread_class_sizing= 0;
368 param.m_table_share_sizing= 0;
369 param.m_file_class_sizing= 0;
370 param.m_socket_class_sizing= 10;
371 param.m_mutex_sizing= 0;
372 param.m_rwlock_sizing= 0;
373 param.m_cond_sizing= 0;
374 param.m_thread_sizing= 0;
375 param.m_table_sizing= 0;
376 param.m_file_sizing= 0;
377 param.m_file_handle_sizing= 0;
378 param.m_socket_sizing= 1000;
379 param.m_events_waits_history_sizing= 0;
380 param.m_events_waits_history_long_sizing= 0;
381 param.m_setup_actor_sizing= 0;
382 param.m_setup_object_sizing= 0;
383
384 init_event_name_sizing(& param);
385 rc= init_instruments(& param);
386 ok(rc == 1, "oom (socket)");
387
388 cleanup_instruments();
389
390 param.m_host_sizing= 0;
391 param.m_user_sizing= 0;
392 param.m_account_sizing= 0;
393 param.m_stage_class_sizing= 0;
394 param.m_events_stages_history_sizing= 0;
395 param.m_events_stages_history_long_sizing= 0;
396 param.m_statement_class_sizing= 0;
397 param.m_events_statements_history_sizing= 0;
398 param.m_events_statements_history_long_sizing= 0;
399 param.m_session_connect_attrs_sizing= 0;
400
401 stub_alloc_fails_after_count= 1;
402 init_event_name_sizing(& param);
403 rc= init_instruments(& param);
404 ok(rc == 1, "oom (per thread waits)");
405 cleanup_instruments();
406
407 param.m_enabled= true;
408 param.m_mutex_class_sizing= 0;
409 param.m_rwlock_class_sizing= 0;
410 param.m_cond_class_sizing= 0;
411 param.m_thread_class_sizing= 10;
412 param.m_table_share_sizing= 0;
413 param.m_file_class_sizing= 0;
414 param.m_mutex_sizing= 0;
415 param.m_rwlock_sizing= 0;
416 param.m_cond_sizing= 0;
417 param.m_thread_sizing= 1000;
418 param.m_table_sizing= 0;
419 param.m_file_sizing= 0;
420 param.m_file_handle_sizing= 0;
421 param.m_events_waits_history_sizing= 0;
422 param.m_events_waits_history_long_sizing= 0;
423 param.m_setup_actor_sizing= 0;
424 param.m_setup_object_sizing= 0;
425 param.m_host_sizing= 0;
426 param.m_user_sizing= 0;
427 param.m_account_sizing= 0;
428 param.m_stage_class_sizing= 0;
429 param.m_events_stages_history_sizing= 10;
430 param.m_events_stages_history_long_sizing= 0;
431 param.m_statement_class_sizing= 0;
432 param.m_events_statements_history_sizing= 0;
433 param.m_events_statements_history_long_sizing= 0;
434 param.m_session_connect_attrs_sizing= 0;
435
436 stub_alloc_fails_after_count= 3;
437 init_event_name_sizing(& param);
438 rc= init_instruments(& param);
439 ok(rc == 1, "oom (thread stages history sizing)");
440
441 cleanup_thread_class();
442 cleanup_instruments();
443
444 param.m_enabled= true;
445 param.m_mutex_class_sizing= 0;
446 param.m_rwlock_class_sizing= 0;
447 param.m_cond_class_sizing= 0;
448 param.m_thread_class_sizing= 10;
449 param.m_table_share_sizing= 0;
450 param.m_file_class_sizing= 0;
451 param.m_mutex_sizing= 0;
452 param.m_rwlock_sizing= 0;
453 param.m_cond_sizing= 0;
454 param.m_thread_sizing= 1000;
455 param.m_table_sizing= 0;
456 param.m_file_sizing= 0;
457 param.m_file_handle_sizing= 0;
458 param.m_events_waits_history_sizing= 0;
459 param.m_events_waits_history_long_sizing= 0;
460 param.m_setup_actor_sizing= 0;
461 param.m_setup_object_sizing= 0;
462 param.m_host_sizing= 0;
463 param.m_user_sizing= 0;
464 param.m_account_sizing= 0;
465 param.m_stage_class_sizing= 50;
466 param.m_events_stages_history_sizing= 0;
467 param.m_events_stages_history_long_sizing= 0;
468 param.m_statement_class_sizing= 0;
469 param.m_events_statements_history_sizing= 0;
470 param.m_events_statements_history_long_sizing= 0;
471 param.m_session_connect_attrs_sizing= 0;
472
473 stub_alloc_fails_after_count= 2;
474 init_event_name_sizing(& param);
475 rc= init_instruments(& param);
476 ok(rc == 1, "oom (per thread stages)");
477
478 cleanup_stage_class();
479 cleanup_thread_class();
480 cleanup_instruments();
481
482 param.m_enabled= true;
483 param.m_mutex_class_sizing= 0;
484 param.m_rwlock_class_sizing= 0;
485 param.m_cond_class_sizing= 0;
486 param.m_thread_class_sizing= 10;
487 param.m_table_share_sizing= 0;
488 param.m_file_class_sizing= 0;
489 param.m_mutex_sizing= 0;
490 param.m_rwlock_sizing= 0;
491 param.m_cond_sizing= 0;
492 param.m_thread_sizing= 1000;
493 param.m_table_sizing= 0;
494 param.m_file_sizing= 0;
495 param.m_file_handle_sizing= 0;
496 param.m_events_waits_history_sizing= 0;
497 param.m_events_waits_history_long_sizing= 0;
498 param.m_setup_actor_sizing= 0;
499 param.m_setup_object_sizing= 0;
500 param.m_host_sizing= 0;
501 param.m_user_sizing= 0;
502 param.m_account_sizing= 0;
503 param.m_stage_class_sizing= 0;
504 param.m_events_stages_history_sizing= 0;
505 param.m_events_stages_history_long_sizing= 0;
506 param.m_statement_class_sizing= 0;
507 param.m_events_statements_history_sizing= 10;
508 param.m_events_statements_history_long_sizing= 0;
509 param.m_session_connect_attrs_sizing= 0;
510
511 stub_alloc_fails_after_count= 2;
512 init_event_name_sizing(& param);
513 rc= init_instruments(& param);
514 ok(rc == 1, "oom (thread statements history sizing)");
515
516 cleanup_thread_class();
517 cleanup_instruments();
518
519 param.m_enabled= true;
520 param.m_mutex_class_sizing= 0;
521 param.m_rwlock_class_sizing= 0;
522 param.m_cond_class_sizing= 0;
523 param.m_thread_class_sizing= 10;
524 param.m_table_share_sizing= 0;
525 param.m_file_class_sizing= 0;
526 param.m_mutex_sizing= 0;
527 param.m_rwlock_sizing= 0;
528 param.m_cond_sizing= 0;
529 param.m_thread_sizing= 1000;
530 param.m_table_sizing= 0;
531 param.m_file_sizing= 0;
532 param.m_file_handle_sizing= 0;
533 param.m_events_waits_history_sizing= 0;
534 param.m_events_waits_history_long_sizing= 0;
535 param.m_setup_actor_sizing= 0;
536 param.m_setup_object_sizing= 0;
537 param.m_host_sizing= 0;
538 param.m_user_sizing= 0;
539 param.m_account_sizing= 0;
540 param.m_stage_class_sizing= 0;
541 param.m_events_stages_history_sizing= 0;
542 param.m_events_stages_history_long_sizing= 0;
543 param.m_statement_class_sizing= 50;
544 param.m_events_statements_history_sizing= 0;
545 param.m_events_statements_history_long_sizing= 0;
546 param.m_session_connect_attrs_sizing= 0;
547
548 stub_alloc_fails_after_count= 2;
549 init_event_name_sizing(& param);
550 rc= init_instruments(& param);
551 ok(rc == 1, "oom (per thread statements)");
552
553 cleanup_statement_class();
554 cleanup_thread_class();
555 cleanup_instruments();
556
557 param.m_enabled= true;
558 param.m_mutex_class_sizing= 10;
559 param.m_rwlock_class_sizing= 0;
560 param.m_cond_class_sizing= 0;
561 param.m_thread_class_sizing= 0;
562 param.m_table_share_sizing= 0;
563 param.m_file_class_sizing= 0;
564 param.m_mutex_sizing= 0;
565 param.m_rwlock_sizing= 0;
566 param.m_cond_sizing= 0;
567 param.m_thread_sizing= 0;
568 param.m_table_sizing= 0;
569 param.m_file_sizing= 0;
570 param.m_file_handle_sizing= 0;
571 param.m_events_waits_history_sizing= 0;
572 param.m_events_waits_history_long_sizing= 0;
573 param.m_setup_actor_sizing= 0;
574 param.m_setup_object_sizing= 0;
575 param.m_host_sizing= 0;
576 param.m_user_sizing= 0;
577 param.m_account_sizing= 0;
578 param.m_stage_class_sizing= 0;
579 param.m_events_stages_history_sizing= 0;
580 param.m_events_stages_history_long_sizing= 0;
581 param.m_statement_class_sizing= 0;
582 param.m_events_statements_history_sizing= 0;
583 param.m_events_statements_history_long_sizing= 0;
584 param.m_session_connect_attrs_sizing= 0;
585
586 stub_alloc_fails_after_count= 1;
587 init_event_name_sizing(& param);
588 rc= init_instruments(& param);
589 ok(rc == 1, "oom (global waits)");
590
591 cleanup_sync_class();
592 cleanup_instruments();
593
594 param.m_enabled= true;
595 param.m_mutex_class_sizing= 10;
596 param.m_rwlock_class_sizing= 0;
597 param.m_cond_class_sizing= 0;
598 param.m_thread_class_sizing= 0;
599 param.m_table_share_sizing= 0;
600 param.m_file_class_sizing= 0;
601 param.m_mutex_sizing= 0;
602 param.m_rwlock_sizing= 0;
603 param.m_cond_sizing= 0;
604 param.m_thread_sizing= 0;
605 param.m_table_sizing= 0;
606 param.m_file_sizing= 0;
607 param.m_file_handle_sizing= 0;
608 param.m_events_waits_history_sizing= 0;
609 param.m_events_waits_history_long_sizing= 0;
610 param.m_setup_actor_sizing= 0;
611 param.m_setup_object_sizing= 0;
612 param.m_host_sizing= 0;
613 param.m_user_sizing= 0;
614 param.m_account_sizing= 0;
615 param.m_stage_class_sizing= 20;
616 param.m_events_stages_history_sizing= 0;
617 param.m_events_stages_history_long_sizing= 0;
618 param.m_statement_class_sizing= 0;
619 param.m_events_statements_history_sizing= 0;
620 param.m_events_statements_history_long_sizing= 0;
621 param.m_session_connect_attrs_sizing= 0;
622
623 stub_alloc_fails_after_count= 3;
624 init_event_name_sizing(& param);
625 rc= init_stage_class(param.m_stage_class_sizing);
626 ok(rc == 0, "init stage class");
627 rc= init_instruments(& param);
628 ok(rc == 1, "oom (global stages)");
629
630 cleanup_sync_class();
631 cleanup_stage_class();
632 cleanup_instruments();
633
634 param.m_enabled= true;
635 param.m_mutex_class_sizing= 10;
636 param.m_rwlock_class_sizing= 0;
637 param.m_cond_class_sizing= 0;
638 param.m_thread_class_sizing= 0;
639 param.m_table_share_sizing= 0;
640 param.m_file_class_sizing= 0;
641 param.m_mutex_sizing= 0;
642 param.m_rwlock_sizing= 0;
643 param.m_cond_sizing= 0;
644 param.m_thread_sizing= 0;
645 param.m_table_sizing= 0;
646 param.m_file_sizing= 0;
647 param.m_file_handle_sizing= 0;
648 param.m_events_waits_history_sizing= 0;
649 param.m_events_waits_history_long_sizing= 0;
650 param.m_setup_actor_sizing= 0;
651 param.m_setup_object_sizing= 0;
652 param.m_host_sizing= 0;
653 param.m_user_sizing= 0;
654 param.m_account_sizing= 0;
655 param.m_stage_class_sizing= 0;
656 param.m_events_stages_history_sizing= 0;
657 param.m_events_stages_history_long_sizing= 0;
658 param.m_statement_class_sizing= 20;
659 param.m_events_statements_history_sizing= 0;
660 param.m_events_statements_history_long_sizing= 0;
661 param.m_session_connect_attrs_sizing= 0;
662
663 stub_alloc_fails_after_count= 3;
664 init_event_name_sizing(& param);
665 rc= init_statement_class(param.m_statement_class_sizing);
666 ok(rc == 0, "init statement class");
667 rc= init_instruments(& param);
668 ok(rc == 1, "oom (global statements)");
669
670 cleanup_sync_class();
671 cleanup_statement_class();
672 cleanup_instruments();
673}
674
675void do_all_tests()
676{
677 test_oom();
678}
679
680int main(int argc, char **argv)
681{
682 plan(20);
683 MY_INIT(argv[0]);
684 do_all_tests();
685 my_end(0);
686 return (exit_status());
687}
688
689