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_class.h>
19#include <pfs_global.h>
20#include <tap.h>
21
22#include "stub_pfs_global.h"
23
24void test_oom()
25{
26 int rc;
27
28 rc= init_sync_class(1000, 0, 0);
29 ok(rc == 1, "oom (mutex)");
30 rc= init_sync_class(0, 1000, 0);
31 ok(rc == 1, "oom (rwlock)");
32 rc= init_sync_class(0, 0, 1000);
33 ok(rc == 1, "oom (cond)");
34 rc= init_thread_class(1000);
35 ok(rc == 1, "oom (thread)");
36 rc= init_file_class(1000);
37 ok(rc == 1, "oom (file)");
38 rc= init_table_share(1000);
39 ok(rc == 1, "oom (cond)");
40 rc= init_socket_class(1000);
41 ok(rc == 1, "oom (socket)");
42 rc= init_stage_class(1000);
43 ok(rc == 1, "oom (stage)");
44 rc= init_statement_class(1000);
45 ok(rc == 1, "oom (statement)");
46
47 cleanup_sync_class();
48 cleanup_thread_class();
49 cleanup_file_class();
50 cleanup_table_share();
51 cleanup_socket_class();
52 cleanup_stage_class();
53 cleanup_statement_class();
54}
55
56void do_all_tests()
57{
58 test_oom();
59}
60
61int main(int argc, char **argv)
62{
63 plan(9);
64 MY_INIT(argv[0]);
65 do_all_tests();
66 my_end(0);
67 return (exit_status());
68}
69
70