ft-clock-test.cc 13.3 KB
Newer Older
1 2
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
Leif Walsh's avatar
Leif Walsh committed
3
#ident "$Id$"
Zardosht Kasheff's avatar
Zardosht Kasheff committed
4 5 6 7 8 9
#ident "Copyright (c) 2007, 2008 Tokutek Inc.  All rights reserved."

#include "test.h"

#include "includes.h"

10
enum ftnode_verify_type {
Zardosht Kasheff's avatar
Zardosht Kasheff committed
11 12 13 14 15 16 17 18 19 20
    read_all=1,
    read_compressed,
    read_none
};

#define MIN(x, y) (((x) < (y)) ? (x) : (y))

static int
string_key_cmp(DB *UU(e), const DBT *a, const DBT *b)
{
21 22
    char *CAST_FROM_VOIDP(s, a->data);
    char *CAST_FROM_VOIDP(t, b->data);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
23 24 25 26 27
    return strcmp(s, t);
}

static int omt_cmp(OMTVALUE p, void *q)
{
28 29
    LEAFENTRY CAST_FROM_VOIDP(a, p);
    LEAFENTRY CAST_FROM_VOIDP(b, q);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
30
    void *ak, *bk;
Yoni Fogel's avatar
Yoni Fogel committed
31
    uint32_t al, bl;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
32 33 34 35 36 37 38 39 40 41 42 43 44
    ak = le_key_and_len(a, &al);
    bk = le_key_and_len(b, &bl);
    int l = MIN(al, bl);
    int c = memcmp(ak, bk, l);
    if (c < 0) { return -1; }
    if (c > 0) { return +1; }
    int d = al - bl;
    if (d < 0) { return -1; }
    if (d > 0) { return +1; }
    else       { return  0; }
}

static LEAFENTRY
45
le_fastmalloc(const char *key, int keylen, const char *val, int vallen)
Zardosht Kasheff's avatar
Zardosht Kasheff committed
46
{
47 48
    LEAFENTRY CAST_FROM_VOIDP(r, toku_malloc(sizeof(r->type) + sizeof(r->keylen) + sizeof(r->u.clean.vallen) +
                                             keylen + vallen));
Zardosht Kasheff's avatar
Zardosht Kasheff committed
49 50 51 52 53 54 55 56 57 58
    resource_assert(r);
    r->type = LE_CLEAN;
    r->keylen = keylen;
    r->u.clean.vallen = vallen;
    memcpy(&r->u.clean.key_val[0], key, keylen);
    memcpy(&r->u.clean.key_val[keylen], val, vallen);
    return r;
}

static LEAFENTRY
59
le_malloc(const char *key, const char *val)
Zardosht Kasheff's avatar
Zardosht Kasheff committed
60 61 62 63 64 65 66 67
{
    int keylen = strlen(key) + 1;
    int vallen = strlen(val) + 1;
    return le_fastmalloc(key, keylen, val, vallen);
}


static void
68
test1(int fd, FT brt_h, FTNODE *dn) {
Zardosht Kasheff's avatar
Zardosht Kasheff committed
69
    int r;
70
    struct ftnode_fetch_extra bfe_all;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
71 72
    brt_h->compare_fun = string_key_cmp;
    fill_bfe_for_full_read(&bfe_all, brt_h);
73 74
    FTNODE_DISK_DATA ndd = NULL;
    r = toku_deserialize_ftnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &ndd, &bfe_all);
Yoni Fogel's avatar
Yoni Fogel committed
75
    bool is_leaf = ((*dn)->height == 0);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
76 77 78 79 80 81
    assert(r==0);
    for (int i = 0; i < (*dn)->n_children; i++) {
        assert(BP_STATE(*dn,i) == PT_AVAIL);
    }
    // should sweep and NOT get rid of anything
    PAIR_ATTR attr;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
82
    memset(&attr,0,sizeof(attr));
83
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
84 85 86 87
    for (int i = 0; i < (*dn)->n_children; i++) {
        assert(BP_STATE(*dn,i) == PT_AVAIL);
    }
    // should sweep and get compress all
88
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
89 90 91 92 93 94 95 96 97
    for (int i = 0; i < (*dn)->n_children; i++) {
        if (!is_leaf) {
            assert(BP_STATE(*dn,i) == PT_COMPRESSED);
        }
        else {
            assert(BP_STATE(*dn,i) == PT_ON_DISK);
        }
    }
    PAIR_ATTR size;
Yoni Fogel's avatar
Yoni Fogel committed
98
    bool req = toku_ftnode_pf_req_callback(*dn, &bfe_all);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
99
    assert(req);
100 101
    toku_ftnode_pf_callback(*dn, ndd, &bfe_all, fd, &size);
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
102 103 104 105
    for (int i = 0; i < (*dn)->n_children; i++) {
        assert(BP_STATE(*dn,i) == PT_AVAIL);
    }
    // should sweep and get compress all
106
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
107 108 109 110 111 112 113 114 115
    for (int i = 0; i < (*dn)->n_children; i++) {
        if (!is_leaf) {
            assert(BP_STATE(*dn,i) == PT_COMPRESSED);
        }
        else {
            assert(BP_STATE(*dn,i) == PT_ON_DISK);
        }
    }    

116
    req = toku_ftnode_pf_req_callback(*dn, &bfe_all);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
117
    assert(req);
118 119
    toku_ftnode_pf_callback(*dn, ndd, &bfe_all, fd, &size);
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
120 121 122 123
    for (int i = 0; i < (*dn)->n_children; i++) {
        assert(BP_STATE(*dn,i) == PT_AVAIL);
    }
    (*dn)->dirty = 1;
124 125 126 127
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
128 129 130
    for (int i = 0; i < (*dn)->n_children; i++) {
        assert(BP_STATE(*dn,i) == PT_AVAIL);
    }
Zardosht Kasheff's avatar
Zardosht Kasheff committed
131
    toku_free(ndd);
132
    toku_ftnode_free(dn);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
133 134 135
}


136
static int search_cmp(struct ft_search* UU(so), DBT* UU(key)) {
Zardosht Kasheff's avatar
Zardosht Kasheff committed
137 138 139 140
    return 0;
}

static void
141 142
test2(int fd, FT brt_h, FTNODE *dn) {
    struct ftnode_fetch_extra bfe_subset;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
143 144 145 146 147
    DBT left, right;
    DB dummy_db;
    memset(&dummy_db, 0, sizeof(dummy_db));
    memset(&left, 0, sizeof(left));
    memset(&right, 0, sizeof(right));
148
    ft_search_t search_t;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
149 150 151 152 153
    
    brt_h->compare_fun = string_key_cmp;
    fill_bfe_for_subset_read(
        &bfe_subset,
        brt_h,
154
        ft_search_init(
Zardosht Kasheff's avatar
Zardosht Kasheff committed
155 156
            &search_t, 
            search_cmp, 
157
            FT_SEARCH_LEFT, 
Zardosht Kasheff's avatar
Zardosht Kasheff committed
158 159 160 161 162
            NULL, 
            NULL
            ),
        &left,
        &right,
Yoni Fogel's avatar
Yoni Fogel committed
163 164 165
        true,
        true,
        false
Zardosht Kasheff's avatar
Zardosht Kasheff committed
166
        );
167 168
    FTNODE_DISK_DATA ndd = NULL;
    int r = toku_deserialize_ftnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &ndd, &bfe_subset);
169
    assert(r==0);
Yoni Fogel's avatar
Yoni Fogel committed
170
    bool is_leaf = ((*dn)->height == 0);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
171 172 173 174 175 176 177 178
    // at this point, although both partitions are available, only the 
    // second basement node should have had its clock
    // touched
    assert(BP_STATE(*dn, 0) == PT_AVAIL);
    assert(BP_STATE(*dn, 1) == PT_AVAIL);
    assert(BP_SHOULD_EVICT(*dn, 0));
    assert(!BP_SHOULD_EVICT(*dn, 1));
    PAIR_ATTR attr;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
179
    memset(&attr,0,sizeof(attr));
180
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
181 182 183
    assert(BP_STATE(*dn, 0) == (is_leaf) ? PT_ON_DISK : PT_COMPRESSED);
    assert(BP_STATE(*dn, 1) == PT_AVAIL);
    assert(BP_SHOULD_EVICT(*dn, 1));
184
    toku_ftnode_pe_callback(*dn, attr, &attr, brt_h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
185 186
    assert(BP_STATE(*dn, 1) == (is_leaf) ? PT_ON_DISK : PT_COMPRESSED);

Yoni Fogel's avatar
Yoni Fogel committed
187
    bool req = toku_ftnode_pf_req_callback(*dn, &bfe_subset);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
188
    assert(req);
189
    toku_ftnode_pf_callback(*dn, ndd, &bfe_subset, fd, &attr);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
190 191 192 193 194
    assert(BP_STATE(*dn, 0) == PT_AVAIL);
    assert(BP_STATE(*dn, 1) == PT_AVAIL);
    assert(BP_SHOULD_EVICT(*dn, 0));
    assert(!BP_SHOULD_EVICT(*dn, 1));

Zardosht Kasheff's avatar
Zardosht Kasheff committed
195
    toku_free(ndd);
196
    toku_ftnode_free(dn);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
197 198 199
}

static void
200 201
test3_leaf(int fd, FT brt_h, FTNODE *dn) {
    struct ftnode_fetch_extra bfe_min;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
202 203 204 205 206 207 208 209 210 211 212
    DBT left, right;
    DB dummy_db;
    memset(&dummy_db, 0, sizeof(dummy_db));
    memset(&left, 0, sizeof(left));
    memset(&right, 0, sizeof(right));
    
    brt_h->compare_fun = string_key_cmp;
    fill_bfe_for_min_read(
        &bfe_min,
        brt_h
        );
213 214
    FTNODE_DISK_DATA ndd = NULL;
    int r = toku_deserialize_ftnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &ndd, &bfe_min);
215
    assert(r==0);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
216 217 218 219 220 221 222
    //
    // make sure we have a leaf
    //
    assert((*dn)->height == 0);
    for (int i = 0; i < (*dn)->n_children; i++) {
        assert(BP_STATE(*dn, i) == PT_ON_DISK);
    }
223
    toku_ftnode_free(dn);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
224
    toku_free(ndd);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
225 226 227 228
}

static void
test_serialize_nonleaf(void) {
229 230
    //    struct ft_handle source_ft;
    struct ftnode sn, *dn;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
231

232
    int fd = open(__SRCFILE__ ".ft_handle", O_RDWR|O_CREAT|O_BINARY, S_IRWXU|S_IRWXG|S_IRWXO); assert(fd >= 0);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
233 234 235

    int r;

236
    //    source_ft.fd=fd;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
237 238 239 240
    sn.max_msn_applied_to_node_on_disk.msn = 0;
    char *hello_string;
    sn.flags = 0x11223344;
    sn.thisnodename.b = 20;
241 242
    sn.layout_version = FT_LAYOUT_VERSION;
    sn.layout_version_original = FT_LAYOUT_VERSION;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
243 244 245 246 247 248
    sn.height = 1;
    sn.n_children = 2;
    sn.dirty = 1;
    hello_string = toku_strdup("hello");
    MALLOC_N(2, sn.bp);
    MALLOC_N(1, sn.childkeys);
249
    toku_fill_dbt(&sn.childkeys[0], hello_string, 6);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
    sn.totalchildkeylens = 6;
    BP_BLOCKNUM(&sn, 0).b = 30;
    BP_BLOCKNUM(&sn, 1).b = 35;
    BP_STATE(&sn,0) = PT_AVAIL;
    BP_STATE(&sn,1) = PT_AVAIL;
    set_BNC(&sn, 0, toku_create_empty_nl());
    set_BNC(&sn, 1, toku_create_empty_nl());
    //Create XIDS
    XIDS xids_0 = xids_get_root_xids();
    XIDS xids_123;
    XIDS xids_234;
    r = xids_create_child(xids_0, &xids_123, (TXNID)123);
    CKERR(r);
    r = xids_create_child(xids_123, &xids_234, (TXNID)234);
    CKERR(r);

266 267 268
    r = toku_bnc_insert_msg(BNC(&sn, 0), "a", 2, "aval", 5, FT_NONE, next_dummymsn(), xids_0, true, NULL, string_key_cmp); assert_zero(r);
    r = toku_bnc_insert_msg(BNC(&sn, 0), "b", 2, "bval", 5, FT_NONE, next_dummymsn(), xids_123, false, NULL, string_key_cmp); assert_zero(r);
    r = toku_bnc_insert_msg(BNC(&sn, 1), "x", 2, "xval", 5, FT_NONE, next_dummymsn(), xids_234, true, NULL, string_key_cmp); assert_zero(r);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
269 270 271 272 273
    //Cleanup:
    xids_destroy(&xids_0);
    xids_destroy(&xids_123);
    xids_destroy(&xids_234);

274 275
    FT_HANDLE XMALLOC(brt);
    FT XCALLOC(brt_h);
276 277 278 279 280 281 282
    toku_ft_init(brt_h,
                 make_blocknum(0),
                 ZERO_LSN,
                 TXNID_NONE,
                 4*1024*1024,
                 128*1024,
                 TOKU_DEFAULT_COMPRESSION_METHOD);
283
    brt->ft = brt_h;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
284 285
    brt_h->panic = 0; brt_h->panic_string = 0;
    toku_blocktable_create_new(&brt_h->blocktable);
286
    { int r_truncate = ftruncate(fd, 0); CKERR(r_truncate); }
Zardosht Kasheff's avatar
Zardosht Kasheff committed
287 288 289 290 291 292 293 294 295 296
    //Want to use block #20
    BLOCKNUM b = make_blocknum(0);
    while (b.b < 20) {
        toku_allocate_blocknum(brt_h->blocktable, &b, brt_h);
    }
    assert(b.b == 20);

    {
        DISKOFF offset;
        DISKOFF size;
Yoni Fogel's avatar
Yoni Fogel committed
297
        toku_blocknum_realloc_on_disk(brt_h->blocktable, b, 100, &offset, brt_h, fd, false);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
298 299 300 301 302 303
        assert(offset==BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);

        toku_translate_blocknum_to_offset_size(brt_h->blocktable, b, &offset, &size);
        assert(offset == BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
        assert(size   == 100);
    }
304
    FTNODE_DISK_DATA ndd = NULL;
Yoni Fogel's avatar
Yoni Fogel committed
305
    r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, true, brt->ft, false);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
306 307 308 309 310 311 312 313 314 315
    assert(r==0);

    test1(fd, brt_h, &dn);
    test2(fd, brt_h, &dn);

    toku_free(hello_string);
    destroy_nonleaf_childinfo(BNC(&sn, 0));
    destroy_nonleaf_childinfo(BNC(&sn, 1));
    toku_free(sn.bp);
    toku_free(sn.childkeys);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
316
    toku_free(ndd);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
317 318 319

    toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
    toku_blocktable_destroy(&brt_h->blocktable);
320
    toku_free(brt_h->h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
321 322 323 324 325 326 327 328
    toku_free(brt_h);
    toku_free(brt);

    r = close(fd); assert(r != -1);
}

static void
test_serialize_leaf(void) {
329 330
    //    struct ft_handle source_ft;
    struct ftnode sn, *dn;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
331

332
    int fd = open(__SRCFILE__ ".ft_handle", O_RDWR|O_CREAT|O_BINARY, S_IRWXU|S_IRWXG|S_IRWXO); assert(fd >= 0);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
333 334 335 336 337 338

    int r;

    sn.max_msn_applied_to_node_on_disk.msn = 0;
    sn.flags = 0x11223344;
    sn.thisnodename.b = 20;
339 340
    sn.layout_version = FT_LAYOUT_VERSION;
    sn.layout_version_original = FT_LAYOUT_VERSION;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
341 342 343 344 345 346 347 348 349
    sn.height = 0;
    sn.n_children = 2;
    sn.dirty = 1;
    LEAFENTRY elts[3];
    elts[0] = le_malloc("a", "aval");
    elts[1] = le_malloc("b", "bval");
    elts[2] = le_malloc("x", "xval");
    MALLOC_N(sn.n_children, sn.bp);
    MALLOC_N(1, sn.childkeys);
350
    toku_fill_dbt(&sn.childkeys[0], toku_xmemdup("b", 2), 2);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
351 352 353 354 355 356 357 358 359 360 361
    sn.totalchildkeylens = 2;
    BP_STATE(&sn,0) = PT_AVAIL;
    BP_STATE(&sn,1) = PT_AVAIL;
    set_BLB(&sn, 0, toku_create_empty_bn());
    set_BLB(&sn, 1, toku_create_empty_bn());
    r = toku_omt_insert(BLB_BUFFER(&sn, 0), elts[0], omt_cmp, elts[0], NULL); assert(r==0);
    r = toku_omt_insert(BLB_BUFFER(&sn, 0), elts[1], omt_cmp, elts[1], NULL); assert(r==0);
    r = toku_omt_insert(BLB_BUFFER(&sn, 1), elts[2], omt_cmp, elts[2], NULL); assert(r==0);
    BLB_NBYTESINBUF(&sn, 0) = 2*(KEY_VALUE_OVERHEAD+2+5) + toku_omt_size(BLB_BUFFER(&sn, 0));
    BLB_NBYTESINBUF(&sn, 1) = 1*(KEY_VALUE_OVERHEAD+2+5) + toku_omt_size(BLB_BUFFER(&sn, 1));

362 363
    FT_HANDLE XMALLOC(brt);
    FT XCALLOC(brt_h);
364 365 366 367 368 369 370
    toku_ft_init(brt_h,
                 make_blocknum(0),
                 ZERO_LSN,
                 TXNID_NONE,
                 4*1024*1024,
                 128*1024,
                 TOKU_DEFAULT_COMPRESSION_METHOD);
371
    brt->ft = brt_h;
Zardosht Kasheff's avatar
Zardosht Kasheff committed
372 373
    brt_h->panic = 0; brt_h->panic_string = 0;
    toku_blocktable_create_new(&brt_h->blocktable);
374
    { int r_truncate = ftruncate(fd, 0); CKERR(r_truncate); }
Zardosht Kasheff's avatar
Zardosht Kasheff committed
375 376 377 378 379 380 381 382 383 384
    //Want to use block #20
    BLOCKNUM b = make_blocknum(0);
    while (b.b < 20) {
        toku_allocate_blocknum(brt_h->blocktable, &b, brt_h);
    }
    assert(b.b == 20);

    {
        DISKOFF offset;
        DISKOFF size;
Yoni Fogel's avatar
Yoni Fogel committed
385
        toku_blocknum_realloc_on_disk(brt_h->blocktable, b, 100, &offset, brt_h, fd, false);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
386 387 388 389 390 391
        assert(offset==BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);

        toku_translate_blocknum_to_offset_size(brt_h->blocktable, b, &offset, &size);
        assert(offset == BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
        assert(size   == 100);
    }
392
    FTNODE_DISK_DATA ndd = NULL;
Yoni Fogel's avatar
Yoni Fogel committed
393
    r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, true, brt->ft, false);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
394 395 396 397 398 399
    assert(r==0);

    test1(fd, brt_h, &dn);
    test3_leaf(fd, brt_h,&dn);

    for (int i = 0; i < sn.n_children-1; ++i) {
400
        toku_free(sn.childkeys[i].data);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
401 402 403 404 405
    }
    for (int i = 0; i < 3; ++i) {
        toku_free(elts[i]);
    }
    for (int i = 0; i < sn.n_children; i++) {
406 407
        struct mempool * mp = &(BLB_BUFFER_MEMPOOL(&sn, i));
	toku_mempool_destroy(mp);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
408 409 410 411 412 413 414
        destroy_basement_node(BLB(&sn, i));
    }
    toku_free(sn.bp);
    toku_free(sn.childkeys);

    toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
    toku_blocktable_destroy(&brt_h->blocktable);
415
    toku_free(brt_h->h);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
416 417
    toku_free(brt_h);
    toku_free(brt);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
418
    toku_free(ndd);
Zardosht Kasheff's avatar
Zardosht Kasheff committed
419 420 421 422 423
    r = close(fd); assert(r != -1);
}

int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
424
    initialize_dummymsn();
Zardosht Kasheff's avatar
Zardosht Kasheff committed
425 426 427 428 429
    test_serialize_nonleaf();
    test_serialize_leaf();

    return 0;
}