<commit_before>/* -*- 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;
}<commit_msg>refs #5138 test-5138 didn't need to be nearly that large<commit_after>/* -*- 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));
    DBT *valp = dbt_init(&val, &i, sizeof(i));
    for (i = 0; i < 1000; ++i) {
        r = db->put(db, txn, keyp, valp, 0);
        CKERR(r);
    }

    r = txn->commit(txn, 0);
    CKERR(r);

    r = db->close(db, 0);
    CKERR(r);
    r = env->close(env, 0);
    CKERR(r);

    return 0;
}
{'fraction_non_alphanumeric': 0.17342931937172776, 'fraction_numerical': 0.024869109947643978, 'mean_word_length': 3.027667984189723, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2187308', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1335, 'n_words': 299}