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
d3460d9f
Commit
d3460d9f
authored
Nov 17, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve teh bugs
git-svn-id:
file:///svn/tokudb@613
c7de825b-a66e-492c-adef-691d508d4ae1
parent
c45b50b9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
8 deletions
+36
-8
src/tests/Makefile
src/tests/Makefile
+9
-3
src/tests/test_db_already_exists.c
src/tests/test_db_already_exists.c
+0
-2
src/tests/test_db_env_open_open_close.c
src/tests/test_db_env_open_open_close.c
+6
-0
src/tests/test_db_env_set_data_dir.c
src/tests/test_db_env_set_data_dir.c
+15
-3
src/tests/test_db_env_strdup_null.c
src/tests/test_db_env_strdup_null.c
+3
-0
src/tests/test_db_subdb.c
src/tests/test_db_subdb.c
+3
-0
No files found.
src/tests/Makefile
View file @
d3460d9f
...
...
@@ -48,15 +48,21 @@ $(ALL_TESTS):
echo
$@
%.bdbrun
:
%.bdb
./
$<
$(VGRIND)
./
$<
%.tdbrun
:
%.tdb
$(VGRIND)
./
$<
# For a few of the tests bdb is making valgrind unhappy.
test_db_already_exists.bdbrun
:
VGRIND=
test_db_dup.bdbrun
:
VGRIND=
test_reverse_compare_fun.bdbrun
:
VGRIND=
test_db_subdb.bdbrun
:
VGRIND=
test_db_env_open_open_close.bdbrun
:
VGRIND=
%.bdb
:
%.c
cc
-DDIR
=
\"
dir.
$<
.bdb
\"
$(CFLAGS)
$<
-ldb
-o
$@
cc
-DDIR
=
\"
dir.
$<
.bdb
\"
-DUSE_BDB
$(CFLAGS)
$<
-ldb
-o
$@
%.tdb
:
%.c
cc
-DDIR
=
\"
dir.
$<
.tdb
\"
$(CFLAGS)
$(TDB_CPPFLAGS)
$(TDB_LOADLIBES)
$<
-o
$@
cc
-DDIR
=
\"
dir.
$<
.tdb
\"
-DUSE_TDB
$(CFLAGS)
$(TDB_CPPFLAGS)
$(TDB_LOADLIBES)
$<
-o
$@
make_libs
:
cd
..
;
make
...
...
src/tests/test_db_already_exists.c
View file @
d3460d9f
...
...
@@ -41,7 +41,5 @@ int main() {
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
chdir
(
".."
);
assert
(
r
==
0
);
return
0
;
}
src/tests/test_db_env_open_open_close.c
View file @
d3460d9f
...
...
@@ -23,7 +23,13 @@ int main() {
assert
(
r
==
0
);
r
=
dbenv
->
open
(
dbenv
,
DIR
,
DB_INIT_MPOOL
|
DB_PRIVATE
,
0666
);
#if defined(USE_TDB)
assert
(
r
!=
0
);
#elif defined(USE_BDB)
assert
(
r
==
0
);
#else
#error huh?
#endif
r
=
dbenv
->
close
(
dbenv
,
0
);
assert
(
r
==
0
);
...
...
src/tests/test_db_env_set_data_dir.c
View file @
d3460d9f
#include <stdio.h>
#include <assert.h>
#include <db.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
// DIR is defined in the Makefile
...
...
@@ -8,6 +13,9 @@ int main() {
DB_ENV
*
dbenv
;
int
r
;
system
(
"rm -rf "
DIR
);
mkdir
(
DIR
,
0777
);
r
=
db_env_create
(
&
dbenv
,
0
);
assert
(
r
==
0
);
...
...
@@ -17,11 +25,15 @@ int main() {
r
=
dbenv
->
set_data_dir
(
dbenv
,
DIR
);
assert
(
r
==
0
);
r
=
dbenv
->
open
(
dbenv
,
DIR
,
DB_
PRIVATE
+
DB_INIT_MPOOL
,
0
);
assert
(
r
==
0
);
r
=
dbenv
->
open
(
dbenv
,
DIR
,
DB_
CREATE
|
DB_PRIVATE
|
DB_INIT_MPOOL
,
0
);
CKERR
(
r
);
r
=
dbenv
->
set_data_dir
(
dbenv
,
DIR
);
#ifdef USE_TDB
// According to the BDB man page, you may not call set_data_dir after doing the open.
// Some versions of BDB don't actually check this or complain
r
=
dbenv
->
set_data_dir
(
dbenv
,
"foo"
DIR
);
assert
(
r
!=
0
);
#endif
r
=
dbenv
->
close
(
dbenv
,
0
);
assert
(
r
==
0
);
...
...
src/tests/test_db_env_strdup_null.c
View file @
d3460d9f
...
...
@@ -15,11 +15,14 @@ int main (int argc, char *argv[]) {
r
=
system
(
"rm -rf "
DIR
);
assert
(
r
==
0
);
r
=
mkdir
(
DIR
,
0777
);
assert
(
r
==
0
);
r
=
db_env_create
(
&
env
,
0
);
assert
(
r
==
0
);
// None of this stuff works with BDB. TDB does more error checking.
#ifdef USE_TDB
r
=
env
->
set_data_dir
(
env
,
NULL
);
assert
(
r
==
EINVAL
);
r
=
env
->
open
(
env
,
NULL
,
DB_PRIVATE
,
0777
);
assert
(
r
==
EINVAL
);
r
=
env
->
open
(
env
,
DIR
,
DB_PRIVATE
,
0777
);
assert
(
r
==
0
);
env
->
set_errpfx
(
env
,
NULL
);
assert
(
1
);
//Did not crash.
r
=
env
->
set_tmp_dir
(
env
,
NULL
);
assert
(
r
==
EINVAL
);
#endif
r
=
env
->
close
(
env
,
0
);
assert
(
r
==
0
);
return
0
;
}
...
...
src/tests/test_db_subdb.c
View file @
d3460d9f
...
...
@@ -33,5 +33,8 @@ int main() {
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
r
=
env
->
close
(
env
,
0
);
assert
(
r
==
0
);
return
0
;
}
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