Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
01bcc08d
Commit
01bcc08d
authored
Nov 19, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some test cleanup
git-svn-id:
file:///svn/tokudb@665
c7de825b-a66e-492c-adef-691d508d4ae1
parent
caad2144
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
45 deletions
+52
-45
src/tests/Makefile
src/tests/Makefile
+5
-2
src/tests/test_db_already_exists.c
src/tests/test_db_already_exists.c
+12
-29
src/tests/test_db_dup.c
src/tests/test_db_dup.c
+3
-1
src/tests/test_db_open_notexist_reopen.c
src/tests/test_db_open_notexist_reopen.c
+10
-8
src/tests/test_db_subdb.c
src/tests/test_db_subdb.c
+18
-4
src/tests/test_env_create_db_create.c
src/tests/test_env_create_db_create.c
+3
-0
src/tests/test_log2.c
src/tests/test_log2.c
+1
-1
No files found.
src/tests/Makefile
View file @
01bcc08d
...
...
@@ -6,7 +6,7 @@ ifeq ($(OSX),OSX)
LIBEXT
=
dylib
VGRIND
=
TDB_LOADLIBES
=
-L
../
-ldb
SETTOKUENV
=
export
DYLD_LIBRARY_PATH
=
..
SETTOKUENV
=
DYLD_LIBRARY_PATH
=
..
UNSETTOKUENV
=
unset
DYLD_LIBRARY_PATH
else
SETTOKUENV
=
true
...
...
@@ -59,15 +59,18 @@ $(ALL_TESTS):
%.bdbrun
:
%.bdb
$(UNSETTOKUENV)
;
$(VGRIND)
./
$<
%.tdbrun
:
%.tdb
$(SETTOKUENV)
;
$(VGRIND)
./
$<
$(SETTOKUENV)
$(VGRIND)
./
$<
# For a few of the tests bdb is making valgrind unhappy.
NO_VGRIND
=
\
db_already_exists
\
db_dup
\
db_env_open_nocreate
\
db_env_open_open_close
\
db_open_notexist_reopen
\
db_remove_subdb
\
db_subdb
\
rand_insert
\
reverse_compare_fun
\
# Comment to terminate list so the previous line can end with a slash
...
...
src/tests/test_db_already_exists.c
View file @
01bcc08d
...
...
@@ -21,41 +21,24 @@ int main() {
r
=
mkdir
(
DIR
,
0777
);
assert
(
r
==
0
);
r
=
chdir
(
DIR
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
CKERR
(
r
);
r
=
db
->
set_flags
(
db
,
DB_DUP
);
CKERR
(
r
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
CKERR
(
r
);
r
=
db
->
close
(
db
,
0
);
CKERR
(
r
);
r
=
db_create
(
&
db
,
null_env
,
0
);
CKERR
(
r
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
CKERR
(
r
);
r
=
db
->
close
(
db
,
0
);
CKERR
(
r
);
r
=
db_create
(
&
db
,
null_env
,
0
);
CKERR
(
r
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_EXCL
,
0666
);
assert
(
r
==
EINVAL
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
db
_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db
->
close
(
db
,
0
);
CKERR
(
r
);
r
=
db_create
(
&
db
,
null_env
,
0
);
CKERR
(
r
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
|
DB_EXCL
,
0666
);
assert
(
r
==
EEXIST
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
db
->
close
(
db
,
0
);
CKERR
(
r
);
return
0
;
}
src/tests/test_db_dup.c
View file @
01bcc08d
...
...
@@ -7,6 +7,8 @@
#include <arpa/inet.h>
#include <db.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
/* verify that the dup flags are written and read from the database file correctly */
void
test_dup_flags
(
int
dup_flags
)
{
printf
(
"test_dup_flags:%d
\n
"
,
dup_flags
);
...
...
@@ -271,7 +273,7 @@ void test_nonleaf_insert(int n, int dup_mode) {
int
v
=
values
[
i
];
DBT
key
,
val
;
r
=
db
->
put
(
db
,
null_txn
,
dbt_init
(
&
key
,
&
k
,
sizeof
k
),
dbt_init
(
&
val
,
&
v
,
sizeof
v
),
0
);
assert
(
r
==
0
);
CKERR
(
r
);
}
/* verify lookups */
...
...
src/tests/test_db_open_notexist_reopen.c
View file @
01bcc08d
...
...
@@ -10,16 +10,18 @@
DB_ENV
*
env
;
DB
*
db
;
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
int
main
(
int
argc
,
char
*
argv
[])
{
int
r
;
system
(
"rm -rf "
DIR
);
r
=
mkdir
(
DIR
,
0777
);
assert
(
r
==
0
);
r
=
db_env_create
(
&
env
,
0
);
assert
(
r
==
0
);
r
=
env
->
open
(
env
,
DIR
,
DB_
PRIVATE
|
DB_CREATE
,
0777
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
env
,
0
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
NULL
,
"doesnotexist.db"
,
"testdb"
,
DB_BTREE
,
0
,
0666
);
assert
(
r
==
ENOENT
);
r
=
db
->
open
(
db
,
NULL
,
"doesnotexist.db"
,
"testdb"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
env
->
close
(
env
,
0
);
assert
(
r
==
0
);
r
=
mkdir
(
DIR
,
0777
);
assert
(
r
==
0
);
r
=
db_env_create
(
&
env
,
0
);
CKERR
(
r
);
r
=
env
->
open
(
env
,
DIR
,
DB_
INIT_MPOOL
|
DB_CREATE
,
0777
);
CKERR
(
r
);
r
=
db_create
(
&
db
,
env
,
0
);
CKERR
(
r
);
r
=
db
->
open
(
db
,
NULL
,
"doesnotexist.db"
,
"testdb"
,
DB_BTREE
,
0
,
0666
);
assert
(
r
==
ENOENT
);
r
=
db
->
open
(
db
,
NULL
,
"doesnotexist.db"
,
"testdb"
,
DB_BTREE
,
DB_CREATE
,
0666
);
CKERR
(
r
);
r
=
db
->
close
(
db
,
0
);
CKERR
(
r
);
r
=
env
->
close
(
env
,
0
);
CKERR
(
r
);
return
0
;
}
src/tests/test_db_subdb.c
View file @
01bcc08d
...
...
@@ -25,16 +25,30 @@ int main() {
r
=
env
->
open
(
env
,
DIR
,
DB_INIT_MPOOL
|
DB_PRIVATE
|
DB_CREATE
|
DB_INIT_LOG
,
0777
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
env
,
0
);
assert
(
r
==
0
);
CKERR
(
r
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
CKERR
(
r
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
CKERR
(
r
);
#if 0
const char * const fname2 = "test2.db";
// This sequence segfaults in BDB 4.3.29
// See what happens if we open a database with a subdb, when the file has only the main db.
r = db->open(db, null_txn, fname2, 0, DB_BTREE, DB_CREATE, 0666);
CKERR(r);
r = db->close(db,0);
CKERR(r);
r = db->open(db, null_txn, fname2, "main", DB_BTREE, 0, 0666);
CKERR(r);
r = db->close(db, 0);
CKERR(r);
#endif
r
=
env
->
close
(
env
,
0
);
assert
(
r
==
0
);
CKERR
(
r
);
return
0
;
}
src/tests/test_env_create_db_create.c
View file @
01bcc08d
...
...
@@ -11,7 +11,10 @@ int main (int argc, char *argv[]) {
r
=
db_env_create
(
&
env
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
env
,
0
);
// BDB doesnt' actually barf on this case.
#ifdef USE_TDB
assert
(
r
!=
0
);
#endif
r
=
env
->
close
(
env
,
0
);
assert
(
r
==
0
);
return
0
;
...
...
src/tests/test_log2.c
View file @
01bcc08d
...
...
@@ -20,7 +20,7 @@ static void make_db (void) {
system
(
"rm -rf "
DIR
);
r
=
mkdir
(
DIR
,
0777
);
assert
(
r
==
0
);
r
=
db_env_create
(
&
env
,
0
);
assert
(
r
==
0
);
r
=
env
->
open
(
env
,
DIR
,
DB_INIT_LOCK
|
DB_INIT_LOG
|
DB_INIT_MPOOL
|
DB_INIT_TXN
|
DB_
PRIVATE
|
DB_
CREATE
,
0777
);
CKERR
(
r
);
r
=
env
->
open
(
env
,
DIR
,
DB_INIT_LOCK
|
DB_INIT_LOG
|
DB_INIT_MPOOL
|
DB_INIT_TXN
|
DB_CREATE
,
0777
);
CKERR
(
r
);
r
=
db_create
(
&
db
,
env
,
0
);
CKERR
(
r
);
r
=
env
->
txn_begin
(
env
,
0
,
&
tid
,
0
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
tid
,
"foo.db"
,
0
,
DB_BTREE
,
DB_CREATE
,
0777
);
CKERR
(
r
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment