Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / test / c / suites / TestEnvMethod.c
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2010, 2012 Oracle and/or its affiliates.  All rights reserved.
5  *
6  * $Id$
7  */
8
9 #include "db.h"
10 #include "CuTest.h"
11 #include "test_util.h"
12
13 int TestSetThreadCount(CuTest *ct) { /* SKIP */
14 /* Run this test only when hash is supported. */
15 #ifdef HAVE_HASH
16         DB_ENV *dbenv;
17         DB *db;
18
19         CuAssert(ct, "db_env_create", db_env_create(&dbenv, 0) == 0);
20
21         dbenv->set_errpfx(dbenv, "TestSetThreadCount");
22         CuAssert(ct, "set_thread_count", dbenv->set_thread_count(dbenv, 2) == 0);
23         CuAssert(ct, "env->open", dbenv->open(dbenv, ".",
24                         DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL |
25                         DB_INIT_TXN | DB_PRIVATE | DB_THREAD, 0) == 0);
26
27         CuAssert(ct, "db_create", db_create(&db, dbenv, 0) == 0);
28         CuAssert(ct, "DB->open", db->open(
29             db, NULL, NULL, "TestSetThreadCount", DB_HASH, DB_CREATE, 0) == 0);
30
31         db->close(db, 0);
32         dbenv->close(dbenv, 0);
33 #else
34         printf("TestSetThreadCount is not supported by the build.\n");
35 #endif /* HAVE_HASH */
36         return (0);
37 }