diff options
author | Terry Wilson <twilson@digium.com> | 2011-07-06 20:58:12 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2011-07-06 20:58:12 +0000 |
commit | efd040cd11cff99a9dccf54c030a134d9a1e2e07 (patch) | |
tree | b4a3f36ffe91a5226485088c3bb2c5c6ac698fa1 /tests/test_db.c | |
parent | a7c6f0445e7bbd1f7aea1687eae52c3ca7cd5756 (diff) |
Replace Berkeley DB with SQLite 3
There were some bugs in the very ancient version of Berkeley DB that Asterisk
used. Instead of spending the time tracking down the bugs in the Berkeley code
we move to the much better documented SQLite 3.
Conversion of the old astdb happens at runtime by running the included
astdb2sqlite3 utility. The ast_db API with SQLite 3 backend should behave
identically to the old Berkeley backend, but in the future we could offer a
much more robust interface.
We do not include the SQLite 3 library in the source tree, but instead rely
upon the distribution-provided libraries. SQLite is so ubiquitous that this
should not place undue burden on administrators.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@326589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_db.c')
-rw-r--r-- | tests/test_db.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_db.c b/tests/test_db.c index 105a6ab1e..95532c780 100644 --- a/tests/test_db.c +++ b/tests/test_db.c @@ -205,10 +205,37 @@ AST_TEST_DEFINE(gettree_deltree) return res; } +AST_TEST_DEFINE(perftest) +{ + int res = AST_TEST_PASS; + size_t x; + char buf[10]; + + switch (cmd) { + case TEST_INIT: + info->name = "perftest"; + info->category = "/main/astdb/"; + info->summary = "astdb performance unit test"; + info->description = + "Measure astdb performance"; + return AST_TEST_NOT_RUN; + case TEST_EXECUTE: + break; + } + + for (x = 0; x < 100000; x++) { + sprintf(buf, "%zu", x); + ast_db_put("astdbtest", buf, buf); + } + ast_db_deltree("astdbtest", NULL); + + return res; +} static int unload_module(void) { AST_TEST_UNREGISTER(put_get_del); AST_TEST_UNREGISTER(gettree_deltree); + AST_TEST_UNREGISTER(perftest); return 0; } @@ -216,6 +243,7 @@ static int load_module(void) { AST_TEST_REGISTER(put_get_del); AST_TEST_REGISTER(gettree_deltree); + AST_TEST_REGISTER(perftest); return AST_MODULE_LOAD_SUCCESS; } |