Commit 145464c7 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Get rid of most CIL warnings. Addresses #1185.

git-svn-id: file:///svn/tokudb.1131b+1080a+1185@6456 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5aef408e
#include "brt-internal.h" #include "includes.h"
#include "toku_assert.h"
int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) { int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) {
BRTNODE node; BRTNODE node;
......
...@@ -24,7 +24,9 @@ struct ctpair_rwlock { ...@@ -24,7 +24,9 @@ struct ctpair_rwlock {
// initialize a read write lock // initialize a read write lock
static void ctpair_rwlock_init(CTPAIR_RWLOCK rwlock) { static __attribute__((__unused__))
void
ctpair_rwlock_init(CTPAIR_RWLOCK rwlock) {
int r; int r;
rwlock->pinned = rwlock->want_pin = 0; rwlock->pinned = rwlock->want_pin = 0;
r = pthread_cond_init(&rwlock->wait_pin, 0); assert(r == 0); r = pthread_cond_init(&rwlock->wait_pin, 0); assert(r == 0);
...@@ -34,7 +36,9 @@ static void ctpair_rwlock_init(CTPAIR_RWLOCK rwlock) { ...@@ -34,7 +36,9 @@ static void ctpair_rwlock_init(CTPAIR_RWLOCK rwlock) {
// destroy a read write lock // destroy a read write lock
static void ctpair_rwlock_destroy(CTPAIR_RWLOCK rwlock) { static __attribute__((__unused__))
void
ctpair_rwlock_destroy(CTPAIR_RWLOCK rwlock) {
int r; int r;
assert(rwlock->pinned == 0 && rwlock->want_pin == 0); assert(rwlock->pinned == 0 && rwlock->want_pin == 0);
assert(rwlock->writer == 0 && rwlock->want_write == 0); assert(rwlock->writer == 0 && rwlock->want_write == 0);
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* Dump the log from stdin to stdout. */ /* Dump the log from stdin to stdout. */
#include "includes.h"
#include "brttypes.h" #include "brttypes.h"
#include "log-internal.h" #include "log-internal.h"
#include "log_header.h" #include "log_header.h"
......
...@@ -126,6 +126,10 @@ CHECKS = \ ...@@ -126,6 +126,10 @@ CHECKS = \
$(REGRESSION_TESTS) \ $(REGRESSION_TESTS) \
# This line intentially kept commented so I can have a \ on the previous line # This line intentially kept commented so I can have a \ on the previous line
ifeq ($(CIL),1)
CC=../../../cil/cil-1.3.6/bin/cilly --merge --keepmerged
endif
build: $(BINS) build: $(BINS)
foo: foo:
echo $(BINS) echo $(BINS)
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "toku_assert.h" #include "includes.h"
#include "brt-internal.h"
#include "kv-pair.h"
#include <fcntl.h>
#include <string.h>
#include <zlib.h>
#include <arpa/inet.h>
#include <stdlib.h>
static void test_serialize(void) { static void test_serialize(void) {
// struct brt source_brt; // struct brt source_brt;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "brt.h" #include "includes.h"
#include "key.h"
#include "brt-internal.h"
#include "memory.h"
#include "toku_assert.h"
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "test.h" #include "test.h"
static const char fname[]= __FILE__ ".brt"; static const char fname[]= __FILE__ ".brt";
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "brt.h" #include "includes.h"
#include "key.h"
#include "brt-internal.h"
#include "memory.h"
#include "toku_assert.h"
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "test.h" #include "test.h"
static const char fname[]= __FILE__ ".brt"; static const char fname[]= __FILE__ ".brt";
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "brt.h" #include "includes.h"
#include "key.h"
#include "brt-internal.h"
#include "memory.h"
#include "toku_assert.h"
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "test.h" #include "test.h"
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "brt.h" #include "includes.h"
#include "key.h"
#include "brt-internal.h"
#include "memory.h"
#include "toku_assert.h"
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "test.h" #include "test.h"
static const char fname[]= __FILE__ ".brt"; static const char fname[]= __FILE__ ".brt";
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "brt.h" #include "includes.h"
#include "key.h"
#include "brt-internal.h"
#include "memory.h"
#include "toku_assert.h"
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "test.h" #include "test.h"
static const char fname[]= __FILE__ ".brt"; static const char fname[]= __FILE__ ".brt";
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
flush (CACHEFILE f __attribute__((__unused__)), flush (CACHEFILE f __attribute__((__unused__)),
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
flush (CACHEFILE f __attribute__((__unused__)), flush (CACHEFILE f __attribute__((__unused__)),
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
cachetable_fd_test (void) { cachetable_fd_test (void) {
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
flush (CACHEFILE f __attribute__((__unused__)), flush (CACHEFILE f __attribute__((__unused__)),
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
flush (CACHEFILE cf __attribute__((__unused__)), flush (CACHEFILE cf __attribute__((__unused__)),
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
flush (CACHEFILE f __attribute__((__unused__)), flush (CACHEFILE f __attribute__((__unused__)),
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include <stdio.h> #include "includes.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <errno.h>
#include <pthread.h>
#include "toku_assert.h"
#include "memory.h"
#include "cachetable.h"
#include "test.h" #include "test.h"
// this mutex is used by some of the tests to serialize access to some // this mutex is used by some of the tests to serialize access to some
......
#include <stdio.h> #include "includes.h"
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include "cachetable-rwlock.h"
int verbose = 0; int verbose = 0;
......
/* How fast can we read a file usng the cachetable interface. */ /* How fast can we read a file usng the cachetable interface. */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include <assert.h> #include "includes.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "cachetable.h"
enum { KEYLIMIT = 4, BLOCKSIZE=1<<20, N=2048}; enum { KEYLIMIT = 4, BLOCKSIZE=1<<20, N=2048};
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include <inttypes.h> #include "includes.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <errno.h>
#include <pthread.h>
#include "toku_assert.h"
#include "memory.h"
#include "cachetable.h"
#include "test.h" #include "test.h"
#if 0 #if 0
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include <inttypes.h> #include "includes.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include "memory.h"
#include "cachetable.h"
#include "toku_assert.h"
#include "test.h" #include "test.h"
// this mutex is used by some of the tests to serialize access to some // this mutex is used by some of the tests to serialize access to some
......
#include <stdio.h> #include "includes.h"
#include <unistd.h>
#include <assert.h>
#include "test.h" #include "test.h"
#include "cachetable.h"
static void static void
flush (CACHEFILE f __attribute__((__unused__)), flush (CACHEFILE f __attribute__((__unused__)),
......
#include <stdio.h> #include "includes.h"
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
int verbose; int verbose;
......
#include <sys/types.h> #include "includes.h"
#include <assert.h>
typedef struct value *OMTVALUE;
#include "omt.h"
enum { N=10 }; enum { N=10 };
struct value { int x; } vs[N]; struct value { int x; } vs[N];
OMTVALUE ps[N]; OMTVALUE ps[N];
#define V(x) ((struct value *)(x))
static void test (void) { static void test (void) {
OMT o; OMT o;
OMTCURSOR curs, curs2, curs3; OMTCURSOR curs, curs2, curs3;
...@@ -28,11 +27,11 @@ static void test (void) { ...@@ -28,11 +27,11 @@ static void test (void) {
r = toku_omt_create_from_sorted_array(&o, ps, 10); assert(r==0); r = toku_omt_create_from_sorted_array(&o, ps, 10); assert(r==0);
r = toku_omt_cursor_create(&curs); assert(r==0); r = toku_omt_cursor_create(&curs); assert(r==0);
r = toku_omt_fetch(o, 5, &v, curs); assert(r==0); r = toku_omt_fetch(o, 5, &v, curs); assert(r==0);
assert(v->x==5); assert(V(v)->x==5);
r = toku_omt_cursor_next(curs, &v); r = toku_omt_cursor_next(curs, &v);
assert(r==0 && v->x==6); assert(r==0 && V(v)->x==6);
r = toku_omt_cursor_prev(curs, &v); r = toku_omt_cursor_prev(curs, &v);
assert(r==0 && v->x==5); assert(r==0 && V(v)->x==5);
toku_omt_cursor_destroy(&curs); toku_omt_cursor_destroy(&curs);
toku_omt_destroy(&o); toku_omt_destroy(&o);
...@@ -42,7 +41,7 @@ static void test (void) { ...@@ -42,7 +41,7 @@ static void test (void) {
r = toku_omt_fetch(o, 5, &v, curs); assert(r==0); r = toku_omt_fetch(o, 5, &v, curs); assert(r==0);
r = toku_omt_cursor_create(&curs2); assert(r==0); r = toku_omt_cursor_create(&curs2); assert(r==0);
r = toku_omt_fetch(o, 4, &v, curs2); assert(r==0); r = toku_omt_fetch(o, 4, &v, curs2); assert(r==0);
r = toku_omt_cursor_next(curs, &v); assert(r==0 && v->x==6); r = toku_omt_cursor_next(curs, &v); assert(r==0 && V(v)->x==6);
toku_omt_destroy(&o); toku_omt_destroy(&o);
toku_omt_cursor_destroy(&curs); toku_omt_cursor_destroy(&curs);
toku_omt_cursor_destroy(&curs2); toku_omt_cursor_destroy(&curs2);
...@@ -53,10 +52,10 @@ static void test (void) { ...@@ -53,10 +52,10 @@ static void test (void) {
r = toku_omt_fetch(o, 5, &v, curs); assert(r==0); r = toku_omt_fetch(o, 5, &v, curs); assert(r==0);
r = toku_omt_cursor_create(&curs2); assert(r==0); r = toku_omt_cursor_create(&curs2); assert(r==0);
r = toku_omt_fetch(o, 4, &v, curs2); assert(r==0); r = toku_omt_fetch(o, 4, &v, curs2); assert(r==0);
r = toku_omt_cursor_next(curs, &v); assert(r==0 && v->x==6); r = toku_omt_cursor_next(curs, &v); assert(r==0 && V(v)->x==6);
r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && v->x==3); r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && V(v)->x==3);
toku_omt_cursor_destroy(&curs); toku_omt_cursor_destroy(&curs);
r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && v->x==2); r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && V(v)->x==2);
toku_omt_cursor_destroy(&curs2); toku_omt_cursor_destroy(&curs2);
toku_omt_destroy(&o); toku_omt_destroy(&o);
...@@ -68,14 +67,14 @@ static void test (void) { ...@@ -68,14 +67,14 @@ static void test (void) {
r = toku_omt_fetch(o, 4, &v, curs2); assert(r==0); r = toku_omt_fetch(o, 4, &v, curs2); assert(r==0);
r = toku_omt_cursor_create(&curs3); assert(r==0); r = toku_omt_cursor_create(&curs3); assert(r==0);
r = toku_omt_fetch(o, 9, &v, curs3); assert(r==0); r = toku_omt_fetch(o, 9, &v, curs3); assert(r==0);
r = toku_omt_cursor_next(curs, &v); assert(r==0 && v->x==6); r = toku_omt_cursor_next(curs, &v); assert(r==0 && V(v)->x==6);
r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && v->x==3); r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && V(v)->x==3);
r = toku_omt_cursor_next(curs3, &v); assert(r!=0 && !toku_omt_cursor_is_valid(curs3)); r = toku_omt_cursor_next(curs3, &v); assert(r!=0 && !toku_omt_cursor_is_valid(curs3));
toku_omt_cursor_destroy(&curs); toku_omt_cursor_destroy(&curs);
r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && v->x==2); r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && V(v)->x==2);
r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && v->x==1); r = toku_omt_cursor_prev(curs2, &v); assert(r==0 && V(v)->x==1);
r = toku_omt_fetch(o, 1, &v, curs3); assert(r==0); r = toku_omt_fetch(o, 1, &v, curs3); assert(r==0);
r = toku_omt_cursor_prev(curs3, &v); assert(r==0 && v->x==0); r = toku_omt_cursor_prev(curs3, &v); assert(r==0 && V(v)->x==0);
r = toku_omt_cursor_prev(curs3, &v); assert(r!=0 && !toku_omt_cursor_is_valid(curs3)); r = toku_omt_cursor_prev(curs3, &v); assert(r!=0 && !toku_omt_cursor_is_valid(curs3));
toku_omt_cursor_destroy(&curs2); toku_omt_cursor_destroy(&curs2);
toku_omt_destroy(&o); toku_omt_destroy(&o);
......
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include <errno.h> #include "includes.h"
#include <sys/types.h>
typedef struct value *OMTVALUE; //typedef struct value *OMTVALUE;
typedef OMTVALUE TESTVALUE; typedef OMTVALUE TESTVALUE;
#include "omt.h"
#include "../newbrt/memory.h"
#include "../newbrt/toku_assert.h"
#include "../include/db.h"
#include "../newbrt/brttypes.h"
#include <stdlib.h>
#include <stdint.h>
/* Things that would go in a omt-tests.h if we split to multiple files later. */ /* Things that would go in a omt-tests.h if we split to multiple files later. */
int verbose=0; int verbose=0;
...@@ -47,6 +39,7 @@ parse_args (int argc, const char *argv[]) { ...@@ -47,6 +39,7 @@ parse_args (int argc, const char *argv[]) {
struct value { struct value {
u_int32_t number; u_int32_t number;
}; };
#define V(x) ((struct value *)(x))
enum rand_type { enum rand_type {
TEST_RANDOM, TEST_RANDOM,
...@@ -150,33 +143,33 @@ init_globals (void) { ...@@ -150,33 +143,33 @@ init_globals (void) {
} }
static void static void
test_close (enum close_when_done close) { test_close (enum close_when_done do_close) {
if (close == KEEP_WHEN_DONE) return; if (do_close == KEEP_WHEN_DONE) return;
assert(close == CLOSE_WHEN_DONE); assert(do_close == CLOSE_WHEN_DONE);
toku_omt_destroy(&omt); toku_omt_destroy(&omt);
assert(omt==NULL); assert(omt==NULL);
} }
static void static void
test_create (enum close_when_done close) { test_create (enum close_when_done do_close) {
int r; int r;
omt = NULL; omt = NULL;
r = toku_omt_create(&omt); r = toku_omt_create(&omt);
CKERR(r); CKERR(r);
assert(omt!=NULL); assert(omt!=NULL);
test_close(close); test_close(do_close);
} }
static void static void
test_create_size (enum close_when_done close) { test_create_size (enum close_when_done do_close) {
test_create(KEEP_WHEN_DONE); test_create(KEEP_WHEN_DONE);
assert(toku_omt_size(omt) == 0); assert(toku_omt_size(omt) == 0);
test_close(close); test_close(do_close);
} }
static void static void
test_create_insert_at_almost_random (enum close_when_done close) { test_create_insert_at_almost_random (enum close_when_done do_close) {
u_int32_t i; u_int32_t i;
int r; int r;
u_int32_t size = 0; u_int32_t size = 0;
...@@ -200,11 +193,11 @@ test_create_insert_at_almost_random (enum close_when_done close) { ...@@ -200,11 +193,11 @@ test_create_insert_at_almost_random (enum close_when_done close) {
r = toku_omt_insert_at(omt, values[0], toku_omt_size(omt)+2); r = toku_omt_insert_at(omt, values[0], toku_omt_size(omt)+2);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
assert(size==toku_omt_size(omt)); assert(size==toku_omt_size(omt));
test_close(close); test_close(do_close);
} }
static void static void
test_create_insert_at_sequential (enum close_when_done close) { test_create_insert_at_sequential (enum close_when_done do_close) {
u_int32_t i; u_int32_t i;
int r; int r;
u_int32_t size = 0; u_int32_t size = 0;
...@@ -225,11 +218,11 @@ test_create_insert_at_sequential (enum close_when_done close) { ...@@ -225,11 +218,11 @@ test_create_insert_at_sequential (enum close_when_done close) {
r = toku_omt_insert_at(omt, values[0], toku_omt_size(omt)+2); r = toku_omt_insert_at(omt, values[0], toku_omt_size(omt)+2);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
assert(size==toku_omt_size(omt)); assert(size==toku_omt_size(omt));
test_close(close); test_close(do_close);
} }
static void static void
test_create_from_sorted_array (enum create_type create_choice, enum close_when_done close) { test_create_from_sorted_array (enum create_type create_choice, enum close_when_done do_close) {
int r; int r;
omt = NULL; omt = NULL;
...@@ -246,14 +239,14 @@ test_create_from_sorted_array (enum create_type create_choice, enum close_when_d ...@@ -246,14 +239,14 @@ test_create_from_sorted_array (enum create_type create_choice, enum close_when_d
else assert(FALSE); else assert(FALSE);
assert(omt!=NULL); assert(omt!=NULL);
test_close(close); test_close(do_close);
} }
static void static void
test_create_from_sorted_array_size (enum create_type create_choice, enum close_when_done close) { test_create_from_sorted_array_size (enum create_type create_choice, enum close_when_done do_close) {
test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE); test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE);
assert(toku_omt_size(omt)==length); assert(toku_omt_size(omt)==length);
test_close(close); test_close(do_close);
} }
static void static void
...@@ -277,15 +270,14 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) { ...@@ -277,15 +270,14 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) {
assert(v != NULL); assert(v != NULL);
assert(v != oldv); assert(v != oldv);
assert(v == val[i]); assert(v == val[i]);
assert(v->number == val[i]->number); assert(V(v)->number == V(val[i])->number);
v = oldv; v = oldv;
r = toku_omt_fetch(omtree, i, &v, c); r = toku_omt_fetch(omtree, i, &v, c);
CKERR(r); CKERR(r);
assert(v != NULL); assert(v != NULL);
assert(v != oldv); assert(v != oldv);
assert(v == val[i]); assert(v == val[i]);
assert(v->number == val[i]->number); assert(V(v)->number == V(val[i])->number);
assert(toku_omt_cursor_is_valid(c)); assert(toku_omt_cursor_is_valid(c));
v = oldv; v = oldv;
...@@ -294,7 +286,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) { ...@@ -294,7 +286,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) {
assert(v != NULL); assert(v != NULL);
assert(v != oldv); assert(v != oldv);
assert(v == val[i]); assert(v == val[i]);
assert(v->number == val[i]->number); assert(V(v)->number == V(val[i])->number);
assert(toku_omt_cursor_is_valid(c)); assert(toku_omt_cursor_is_valid(c));
v = oldv; v = oldv;
...@@ -304,7 +296,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) { ...@@ -304,7 +296,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) {
assert(v != NULL); assert(v != NULL);
assert(v != oldv); assert(v != oldv);
assert(v == val[j]); assert(v == val[j]);
assert(v->number == val[j]->number); assert(V(v)->number == V(val[j])->number);
j++; j++;
v = oldv; v = oldv;
} }
...@@ -318,7 +310,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) { ...@@ -318,7 +310,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) {
assert(v != NULL); assert(v != NULL);
assert(v != oldv); assert(v != oldv);
assert(v == val[i]); assert(v == val[i]);
assert(v->number == val[i]->number); assert(V(v)->number == V(val[i])->number);
v = oldv; v = oldv;
j = i - 1; j = i - 1;
...@@ -327,7 +319,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) { ...@@ -327,7 +319,7 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) {
assert(v != NULL); assert(v != NULL);
assert(v != oldv); assert(v != oldv);
assert(v == val[j]); assert(v == val[j]);
assert(v->number == val[j]->number); assert(V(v)->number == V(val[j])->number);
j--; j--;
v = oldv; v = oldv;
} }
...@@ -351,10 +343,10 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) { ...@@ -351,10 +343,10 @@ test_fetch_verify (OMT omtree, TESTVALUE* val, u_int32_t len ) {
} }
static void static void
test_create_fetch_verify (enum create_type create_choice, enum close_when_done close) { test_create_fetch_verify (enum create_type create_choice, enum close_when_done do_close) {
test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE); test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE);
test_fetch_verify(omt, values, length); test_fetch_verify(omt, values, length);
test_close(close); test_close(do_close);
} }
static int iterate_helper_error_return = 1; static int iterate_helper_error_return = 1;
...@@ -365,7 +357,7 @@ iterate_helper (TESTVALUE v, u_int32_t idx, void* extra) { ...@@ -365,7 +357,7 @@ iterate_helper (TESTVALUE v, u_int32_t idx, void* extra) {
TESTVALUE* vals = (TESTVALUE *)extra; TESTVALUE* vals = (TESTVALUE *)extra;
assert(v != NULL); assert(v != NULL);
assert(v == vals[idx]); assert(v == vals[idx]);
assert(v->number == vals[idx]->number); assert(V(v)->number == V(vals[idx])->number);
return 0; return 0;
} }
...@@ -386,10 +378,10 @@ test_iterate_verify (OMT omtree, TESTVALUE* vals, u_int32_t len) { ...@@ -386,10 +378,10 @@ test_iterate_verify (OMT omtree, TESTVALUE* vals, u_int32_t len) {
} }
static void static void
test_create_iterate_verify (enum create_type create_choice, enum close_when_done close) { test_create_iterate_verify (enum create_type create_choice, enum close_when_done do_close) {
test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE); test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE);
test_iterate_verify(omt, values, length); test_iterate_verify(omt, values, length);
test_close(close); test_close(do_close);
} }
...@@ -414,7 +406,7 @@ permute_array (u_int32_t* arr, u_int32_t len) { ...@@ -414,7 +406,7 @@ permute_array (u_int32_t* arr, u_int32_t len) {
} }
static void static void
test_create_set_at (enum create_type create_choice, enum close_when_done close) { test_create_set_at (enum create_type create_choice, enum close_when_done do_close) {
u_int32_t i = 0; u_int32_t i = 0;
struct value* old_nums = NULL; struct value* old_nums = NULL;
...@@ -463,7 +455,7 @@ test_create_set_at (enum create_type create_choice, enum close_when_done close) ...@@ -463,7 +455,7 @@ test_create_set_at (enum create_type create_choice, enum close_when_done close)
toku_free(old_values); toku_free(old_values);
toku_free(old_nums); toku_free(old_nums);
test_close(close); test_close(do_close);
} }
static int static int
...@@ -471,13 +463,13 @@ insert_helper (TESTVALUE value, void* extra_insert) { ...@@ -471,13 +463,13 @@ insert_helper (TESTVALUE value, void* extra_insert) {
TESTVALUE to_insert = (OMTVALUE)extra_insert; TESTVALUE to_insert = (OMTVALUE)extra_insert;
assert(to_insert); assert(to_insert);
if (value->number < to_insert->number) return -1; if (V(value)->number < V(to_insert)->number) return -1;
if (value->number > to_insert->number) return +1; if (V(value)->number > V(to_insert)->number) return +1;
return 0; return 0;
} }
static void static void
test_create_insert (enum close_when_done close) { test_create_insert (enum close_when_done do_close) {
u_int32_t i = 0; u_int32_t i = 0;
u_int32_t* perm = NULL; u_int32_t* perm = NULL;
...@@ -500,10 +492,10 @@ test_create_insert (enum close_when_done close) { ...@@ -500,10 +492,10 @@ test_create_insert (enum close_when_done close) {
CKERR(r); CKERR(r);
assert(idx <= length); assert(idx <= length);
if (idx > 0) { if (idx > 0) {
assert(to_insert->number > values[idx-1]->number); assert(V(to_insert)->number > V(values[idx-1])->number);
} }
if (idx < length) { if (idx < length) {
assert(to_insert->number < values[idx]->number); assert(V(to_insert)->number < V(values[idx])->number);
} }
length++; length++;
assert(length==toku_omt_size(omt)); assert(length==toku_omt_size(omt));
...@@ -519,7 +511,7 @@ test_create_insert (enum close_when_done close) { ...@@ -519,7 +511,7 @@ test_create_insert (enum close_when_done close) {
r = toku_omt_insert(omt, to_insert, insert_helper, to_insert, &idx); r = toku_omt_insert(omt, to_insert, insert_helper, to_insert, &idx);
CKERR2(r, DB_KEYEXIST); CKERR2(r, DB_KEYEXIST);
assert(idx < length); assert(idx < length);
assert(values[idx]->number == to_insert->number); assert(V(values[idx])->number == V(to_insert)->number);
assert(length==toku_omt_size(omt)); assert(length==toku_omt_size(omt));
test_iterate_verify(omt, values, length); test_iterate_verify(omt, values, length);
...@@ -528,11 +520,11 @@ test_create_insert (enum close_when_done close) { ...@@ -528,11 +520,11 @@ test_create_insert (enum close_when_done close) {
toku_free(perm); toku_free(perm);
test_close(close); test_close(do_close);
} }
static void static void
test_create_delete_at (enum create_type create_choice, enum close_when_done close) { test_create_delete_at (enum create_type create_choice, enum close_when_done do_close) {
u_int32_t i = 0; u_int32_t i = 0;
int r = ENOSYS; int r = ENOSYS;
test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE); test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE);
...@@ -562,11 +554,11 @@ test_create_delete_at (enum create_type create_choice, enum close_when_done clos ...@@ -562,11 +554,11 @@ test_create_delete_at (enum create_type create_choice, enum close_when_done clos
assert(length == toku_omt_size(omt)); assert(length == toku_omt_size(omt));
r = toku_omt_delete_at(omt, length+1); r = toku_omt_delete_at(omt, length+1);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
test_close(close); test_close(do_close);
} }
static void static void
test_split_merge (enum create_type create_choice, enum close_when_done close) { test_split_merge (enum create_type create_choice, enum close_when_done do_close) {
int r = ENOSYS; int r = ENOSYS;
u_int32_t i = 0; u_int32_t i = 0;
OMT left_split = NULL; OMT left_split = NULL;
...@@ -623,7 +615,7 @@ test_split_merge (enum create_type create_choice, enum close_when_done close) { ...@@ -623,7 +615,7 @@ test_split_merge (enum create_type create_choice, enum close_when_done close) {
test_fetch_verify(omt, values, length); test_fetch_verify(omt, values, length);
test_iterate_verify(omt, values, length); test_iterate_verify(omt, values, length);
} }
test_close(close); test_close(do_close);
} }
...@@ -681,7 +673,7 @@ test_heaviside (OMTVALUE v_omt, void* x) { ...@@ -681,7 +673,7 @@ test_heaviside (OMTVALUE v_omt, void* x) {
assert(v && x); assert(v && x);
assert(extra->first_zero <= extra->first_pos); assert(extra->first_zero <= extra->first_pos);
u_int32_t value = v->number; u_int32_t value = V(v)->number;
if (value < extra->first_zero) return -1; if (value < extra->first_zero) return -1;
if (value < extra->first_pos) return 0; if (value < extra->first_pos) return 0;
return 1; return 1;
...@@ -726,7 +718,7 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*), ...@@ -726,7 +718,7 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*),
found = FALSE; found = FALSE;
} }
else { else {
assert(omt_val->number == number_expect); assert(V(omt_val)->number == number_expect);
found = TRUE; found = TRUE;
} }
...@@ -743,8 +735,8 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*), ...@@ -743,8 +735,8 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*),
if (found) assert(tmp==omt_val); if (found) assert(tmp==omt_val);
assert(omt_val_curs != NULL); assert(omt_val_curs != NULL);
assert(omt_val_curs == tmp); assert(omt_val_curs == tmp);
assert(omt_val_curs->number == tmp->number); assert(V(omt_val_curs)->number == V(tmp)->number);
if (found) assert(omt_val_curs->number==number_expect); if (found) assert(V(omt_val_curs)->number==number_expect);
} }
toku_omt_cursor_invalidate(c); toku_omt_cursor_invalidate(c);
...@@ -784,7 +776,7 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*), ...@@ -784,7 +776,7 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*),
assert(omt_val == NULL); assert(omt_val == NULL);
} }
else { else {
assert(omt_val->number == number_expect); assert(V(omt_val)->number == number_expect);
} }
/* Verify we can pass NULL both. */ /* Verify we can pass NULL both. */
...@@ -802,7 +794,7 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*), ...@@ -802,7 +794,7 @@ test_find_dir (int dir, void* extra, int (*h)(OMTVALUE, void*),
} }
static void static void
test_find (enum create_type create_choice, enum close_when_done close) { test_find (enum create_type create_choice, enum close_when_done do_close) {
h_extra extra; h_extra extra;
init_identity_values(random_seed, 100); init_identity_values(random_seed, 100);
test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE); test_create_from_sorted_array(create_choice, KEEP_WHEN_DONE);
...@@ -872,7 +864,7 @@ test_find (enum create_type create_choice, enum close_when_done close) { ...@@ -872,7 +864,7 @@ test_find (enum create_type create_choice, enum close_when_done close) {
test_find_dir(0, &extra, test_heaviside, 0, TRUE, length/3, length/3, TRUE); test_find_dir(0, &extra, test_heaviside, 0, TRUE, length/3, length/3, TRUE);
/* Cleanup */ /* Cleanup */
test_close(close); test_close(do_close);
} }
static void static void
......
/* The goal of this test. Make sure that inserts stay behind deletes. */ /* The goal of this test. Make sure that inserts stay behind deletes. */
#include "brt.h" #include "includes.h"
#include "key.h"
#include "toku_assert.h"
#include "brt-internal.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
......
...@@ -26,16 +26,7 @@ ...@@ -26,16 +26,7 @@
* *
*/ */
#include "brt.h" #include "includes.h"
#include "key.h"
#include "toku_assert.h"
#include "brt-internal.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 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