mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
lmdb: fix test#6 and run it by 'make test'.
Change-Id: I3a5bb363368f46576a5acaf332f9fd7feb46a3e5
This commit is contained in:
parent
548d9d4b03
commit
da5e3d5133
3
Makefile
3
Makefile
@ -33,7 +33,7 @@ IHDRS = lmdb.h
|
||||
ILIBS = liblmdb.a liblmdb.so
|
||||
IPROGS = mdb_stat mdb_copy mdb_dump mdb_load mdb_chk
|
||||
IDOCS = mdb_stat.1 mdb_copy.1 mdb_dump.1 mdb_load.1
|
||||
PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
|
||||
PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5 mtest6
|
||||
all: $(ILIBS) $(PROGS)
|
||||
|
||||
install: $(ILIBS) $(IPROGS) $(IHDRS)
|
||||
@ -52,6 +52,7 @@ test: all
|
||||
&& echo "*** LMDB-TEST-3" && ./mtest3 && ./mdb_chk testdb \
|
||||
&& echo "*** LMDB-TEST-4" && ./mtest4 && ./mdb_chk testdb \
|
||||
&& echo "*** LMDB-TEST-5" && ./mtest5 && ./mdb_chk testdb \
|
||||
&& echo "*** LMDB-TEST-6" && ./mtest6 && ./mdb_chk testdb \
|
||||
&& echo "*** LMDB-TESTs - all done"
|
||||
|
||||
liblmdb.a: mdb.o midl.o
|
||||
|
2
lmdb.h
2
lmdb.h
@ -1639,6 +1639,8 @@ int mdb_setup_debug(int flags, MDB_debug_func* logger, long edge_txn);
|
||||
typedef int MDB_pgwalk_func(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi, char type);
|
||||
int mdb_env_pgwalk(MDB_txn *txn, MDB_pgwalk_func* visitor, void* ctx);
|
||||
|
||||
char* mdb_dkey(MDB_val *key, char *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
14
mtest6.c
14
mtest6.c
@ -28,15 +28,13 @@ char dkbuf[1024];
|
||||
|
||||
int main(int argc,char * argv[])
|
||||
{
|
||||
int i = 0, j = 0, rc;
|
||||
int i = 0, rc;
|
||||
MDB_env *env;
|
||||
MDB_dbi dbi;
|
||||
MDB_val key, data;
|
||||
MDB_txn *txn;
|
||||
MDB_stat mst;
|
||||
MDB_cursor *cursor;
|
||||
int count;
|
||||
int *values;
|
||||
long kval;
|
||||
char *sval;
|
||||
|
||||
@ -61,19 +59,19 @@ int main(int argc,char * argv[])
|
||||
printf("Adding 12 values, should yield 3 splits\n");
|
||||
for (i=0;i<12;i++) {
|
||||
kval = i*5;
|
||||
sprintf(sval, "%08x", kval);
|
||||
sprintf(sval, "%08lx", kval);
|
||||
(void)RES(MDB_KEYEXIST, mdb_cursor_put(cursor, &key, &data, MDB_NOOVERWRITE));
|
||||
}
|
||||
printf("Adding 12 more values, should yield 3 splits\n");
|
||||
for (i=0;i<12;i++) {
|
||||
kval = i*5+4;
|
||||
sprintf(sval, "%08x", kval);
|
||||
sprintf(sval, "%08lx", kval);
|
||||
(void)RES(MDB_KEYEXIST, mdb_cursor_put(cursor, &key, &data, MDB_NOOVERWRITE));
|
||||
}
|
||||
printf("Adding 12 more values, should yield 3 splits\n");
|
||||
for (i=0;i<12;i++) {
|
||||
kval = i*5+1;
|
||||
sprintf(sval, "%08x", kval);
|
||||
sprintf(sval, "%08lx", kval);
|
||||
(void)RES(MDB_KEYEXIST, mdb_cursor_put(cursor, &key, &data, MDB_NOOVERWRITE));
|
||||
}
|
||||
E(mdb_cursor_get(cursor, &key, &data, MDB_FIRST));
|
||||
@ -88,7 +86,9 @@ int main(int argc,char * argv[])
|
||||
mdb_txn_commit(txn);
|
||||
|
||||
#if 0
|
||||
j=0;
|
||||
int j=0;
|
||||
int count = 333;
|
||||
int *values = alloca(sizeof(int) * count);
|
||||
|
||||
for (i= count - 1; i > -1; i-= (rand()%5)) {
|
||||
j++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user