~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/perfschema/unittest/pfs_instr_class-oom-t.cc

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2008, 2011, 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
#include "stub_server_misc.h"
 
24
 
 
25
void test_oom()
 
26
{
 
27
  int rc;
 
28
 
 
29
  rc= init_sync_class(1000, 0, 0);
 
30
  ok(rc == 1, "oom (mutex)");
 
31
  rc= init_sync_class(0, 1000, 0);
 
32
  ok(rc == 1, "oom (rwlock)");
 
33
  rc= init_sync_class(0, 0, 1000);
 
34
  ok(rc == 1, "oom (cond)");
 
35
  rc= init_thread_class(1000);
 
36
  ok(rc == 1, "oom (thread)");
 
37
  rc= init_file_class(1000);
 
38
  ok(rc == 1, "oom (file)");
 
39
  rc= init_table_share(1000);
 
40
  ok(rc == 1, "oom (cond)");
 
41
 
 
42
  cleanup_sync_class();
 
43
  cleanup_thread_class();
 
44
  cleanup_file_class();
 
45
  cleanup_table_share();
 
46
}
 
47
 
 
48
void do_all_tests()
 
49
{
 
50
  PFS_atomic::init();
 
51
 
 
52
  test_oom();
 
53
 
 
54
  PFS_atomic::cleanup();
 
55
}
 
56
 
 
57
int main(int argc, char **argv)
 
58
{
 
59
  plan(6);
 
60
  MY_INIT(argv[0]);
 
61
  do_all_tests();
 
62
  my_end(0);
 
63
  return 0;
 
64
}
 
65
 
 
66