2011-06-30 17:46:53 +02:00
|
|
|
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
2010-01-11 18:47:27 -07:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2010-07-15 17:44:45 -06:00
|
|
|
along with this program; if not, write to the Free Software Foundation,
|
|
|
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
|
2010-01-11 18:47:27 -07:00
|
|
|
|
2010-03-31 16:05:33 +02:00
|
|
|
#include <my_global.h>
|
2010-07-15 17:44:45 -06:00
|
|
|
#include <my_pthread.h>
|
2010-01-11 18:47:27 -07:00
|
|
|
#include <pfs_instr_class.h>
|
|
|
|
#include <pfs_global.h>
|
|
|
|
#include <tap.h>
|
|
|
|
|
|
|
|
#include "stub_pfs_global.h"
|
2010-11-16 09:36:42 +01:00
|
|
|
#include "stub_server_misc.h"
|
2010-01-11 18:47:27 -07:00
|
|
|
|
|
|
|
void test_oom()
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc= init_sync_class(1000, 0, 0);
|
|
|
|
ok(rc == 1, "oom (mutex)");
|
|
|
|
rc= init_sync_class(0, 1000, 0);
|
|
|
|
ok(rc == 1, "oom (rwlock)");
|
|
|
|
rc= init_sync_class(0, 0, 1000);
|
|
|
|
ok(rc == 1, "oom (cond)");
|
|
|
|
rc= init_thread_class(1000);
|
|
|
|
ok(rc == 1, "oom (thread)");
|
|
|
|
rc= init_file_class(1000);
|
|
|
|
ok(rc == 1, "oom (file)");
|
|
|
|
rc= init_table_share(1000);
|
|
|
|
ok(rc == 1, "oom (cond)");
|
2012-08-01 17:27:34 +03:00
|
|
|
rc= init_socket_class(1000);
|
|
|
|
ok(rc == 1, "oom (socket)");
|
|
|
|
rc= init_stage_class(1000);
|
|
|
|
ok(rc == 1, "oom (stage)");
|
|
|
|
rc= init_statement_class(1000);
|
|
|
|
ok(rc == 1, "oom (statement)");
|
2010-01-11 18:47:27 -07:00
|
|
|
|
|
|
|
cleanup_sync_class();
|
|
|
|
cleanup_thread_class();
|
|
|
|
cleanup_file_class();
|
|
|
|
cleanup_table_share();
|
2012-08-01 17:27:34 +03:00
|
|
|
cleanup_socket_class();
|
|
|
|
cleanup_stage_class();
|
|
|
|
cleanup_statement_class();
|
2010-01-11 18:47:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void do_all_tests()
|
|
|
|
{
|
|
|
|
test_oom();
|
|
|
|
}
|
|
|
|
|
2012-03-13 13:29:44 +01:00
|
|
|
int main(int argc, char **argv)
|
2010-01-11 18:47:27 -07:00
|
|
|
{
|
2012-08-01 17:27:34 +03:00
|
|
|
plan(9);
|
2012-03-13 13:29:44 +01:00
|
|
|
MY_INIT(argv[0]);
|
2010-01-11 18:47:27 -07:00
|
|
|
do_all_tests();
|
2012-03-13 13:29:44 +01:00
|
|
|
my_end(0);
|
2013-07-16 12:26:04 +03:00
|
|
|
return exit_status();
|
2010-01-11 18:47:27 -07:00
|
|
|
}
|
|
|
|
|