Commit f63c80c7 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

closes #5138 add test for 5138

git-svn-id: file:///svn/toku/tokudb@45196 c7de825b-a66e-492c-adef-691d508d4ae1
parent c4b286af
......@@ -316,6 +316,16 @@ if(BUILD_TESTING)
loader-tpch-load.loader
)
## #5138 only reproduces when using the static library.
list(REMOVE_ITEM tdb_bins test-5138.tdb)
add_executable(test-5138.tdb test-5138.c)
target_link_libraries(test-5138.tdb ${LIBTOKUDB}_static ${LIBTOKUPORTABILITY}_static)
set_property(TARGET test-5138.tdb APPEND PROPERTY
COMPILE_DEFINITIONS "ENVDIR=\"dir.test-5138.tdb\";USE_TDB;IS_TDB=1;TOKUDB=1")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "dir.test-5138.tdb")
add_common_options_to_binary_targets(test-5138.tdb)
add_test(ydb/test-5138.tdb test-5138.tdb)
foreach(bin ${tdb_bins})
get_filename_component(base ${bin} NAME_WE)
set(src ${base}.c)
......
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "$Id$"
// test that with full optimizations including the "last IPO pass" and
// static linking doesn't break lzma
#include "test.h"
int test_main(int argc, char * const argv[]) {
int r;
parse_args(argc, argv);
r = system("rm -rf " ENVDIR);
CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
DB_ENV *env;
r = db_env_create(&env, 0);
CKERR(r);
env->set_errfile(env, stderr);
r = env->open(env, ENVDIR, DB_INIT_MPOOL|DB_CREATE|DB_THREAD|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
DB *db;
DB_TXN *txn = NULL;
r = env->txn_begin(env, NULL, &txn, 0);
CKERR(r);
r = db_create(&db, env, 0);
CKERR(r);
r = db->set_compression_method(db, TOKU_LZMA_METHOD);
CKERR(r);
r = db->open(db, txn, "foo.db", NULL, DB_BTREE, DB_CREATE, 0666);
CKERR(r);
DBT key, val;
unsigned int i;
DBT *keyp = dbt_init(&key, &i, sizeof(i));
char *XCALLOC_N(4096, valbuf);
DBT *valp = dbt_init(&val, valbuf, 4096);
for (i = 0; i < 100000; ++i) {
r = db->put(db, txn, keyp, valp, 0);
CKERR(r);
}
toku_free(valbuf);
r = txn->commit(txn, 0);
CKERR(r);
r = db->close(db, 0);
CKERR(r);
r = env->close(env, 0);
CKERR(r);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment