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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6530c1c2
Commit
6530c1c2
authored
Dec 19, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve testing. Addresses #179, #178.
git-svn-id:
file:///svn/tokudb@1261
c7de825b-a66e-492c-adef-691d508d4ae1
parent
f31f24c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
23 deletions
+39
-23
src/tests/test_dup_dup.c
src/tests/test_dup_dup.c
+39
-23
No files found.
src/tests/test_dup_dup.c
View file @
6530c1c2
...
...
@@ -17,11 +17,21 @@ int errors;
void
db_put
(
DB
*
db
,
int
k
,
int
v
,
u_int32_t
put_flags
,
int
rexpect
)
{
DBT
key
,
val
;
// Turn off error messages if we expect there to be an error.
if
(
rexpect
!=
0
)
{
db
->
set_errfile
(
db
,
0
);
}
else
{
db
->
set_errfile
(
db
,
stderr
);
}
int
r
=
db
->
put
(
db
,
0
,
dbt_init
(
&
key
,
&
k
,
sizeof
k
),
dbt_init
(
&
val
,
&
v
,
sizeof
v
),
put_flags
);
if
(
r
!=
rexpect
)
{
#if USE_TDB
if
(
r
==
EINVAL
&&
put_flags
==
DB_NODUPDATA
)
{
printf
(
"%s:%d:WARNING:tokdub does not support DB_NODUPDATA yet
\n
"
,
__FILE__
,
__LINE__
);
static
int
did_warn
=
0
;
if
(
!
did_warn
)
{
printf
(
"%s:%d:WARNING:tokdub does not support DB_NODUPDATA yet
\n
"
,
__FILE__
,
__LINE__
);
did_warn
=
1
;
}
return
;
}
#endif
...
...
@@ -30,6 +40,19 @@ void db_put(DB *db, int k, int v, u_int32_t put_flags, int rexpect) {
}
}
int
maybe_do_db_dup_warning
(
int
r
,
int
dup_mode
)
{
#if USE_TDB
static
int
did_warn
=
0
;
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
if
(
did_warn
==
0
)
{
did_warn
=
1
;
printf
(
"%s:%d:WARNING: tokudb does not support DB_DUP
\n
"
,
__FILE__
,
__LINE__
);
}
return
1
;
}
#endif
return
0
;
}
void
test_dup_key
(
int
dup_mode
,
u_int32_t
put_flags
,
int
rexpect
,
int
rexpectdupdup
)
{
if
(
verbose
)
printf
(
"test_dup_key: %d, %u, %d, %d
\n
"
,
dup_mode
,
put_flags
,
rexpect
,
rexpectdupdup
);
...
...
@@ -45,13 +68,10 @@ void test_dup_key(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
db
->
set_errfile
(
db
,
stderr
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
#if USE_TDB
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
printf
(
"%s:%d:WARNING: tokudb does not support DB_DUP
\n
"
,
__FILE__
,
__LINE__
);
if
(
maybe_do_db_dup_warning
(
r
,
dup_mode
))
{
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
return
;
return
;
}
#endif
assert
(
r
==
0
);
r
=
db
->
set_pagesize
(
db
,
4096
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
...
...
@@ -96,13 +116,10 @@ void test_dup_dup(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
db
->
set_errfile
(
db
,
stderr
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
#if USE_TDB
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
printf
(
"%s:%d:WARNING: tokudb does not support DB_DUP
\n
"
,
__FILE__
,
__LINE__
);
if
(
maybe_do_db_dup_warning
(
r
,
dup_mode
))
{
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
return
;
return
;
}
#endif
assert
(
r
==
0
);
r
=
db
->
set_pagesize
(
db
,
4096
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
...
...
@@ -147,13 +164,10 @@ void test_put_00_01_01(int dup_mode, u_int32_t put_flags) {
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
db
->
set_errfile
(
db
,
stderr
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
#if USE_TDB
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
printf
(
"%s:%d:WARNING: tokudb does not support DB_DUP
\n
"
,
__FILE__
,
__LINE__
);
if
(
maybe_do_db_dup_warning
(
r
,
dup_mode
))
{
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
0
);
return
;
return
;
}
#endif
assert
(
r
==
0
);
r
=
db
->
set_pagesize
(
db
,
4096
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
...
...
@@ -194,6 +208,11 @@ void test_put_00_01_01(int dup_mode, u_int32_t put_flags) {
int
main
(
int
argc
,
const
char
*
argv
[])
{
int
yes_overwrite
=
0
;
#ifdef USE_TDB
yes_overwrite
=
DB_YESOVERWRITE
;
#endif
parse_args
(
argc
,
argv
);
system
(
"rm -rf "
DIR
);
...
...
@@ -202,11 +221,8 @@ int main(int argc, const char *argv[]) {
test_put_00_01_01
(
0
,
0
);
test_put_00_01_01
(
0
,
DB_NOOVERWRITE
);
test_put_00_01_01
(
DB_DUP
|
DB_DUPSORT
,
0
);
test_put_00_01_01
(
DB_DUP
|
DB_DUPSORT
,
yes_overwrite
);
test_put_00_01_01
(
DB_DUP
|
DB_DUPSORT
,
DB_NOOVERWRITE
);
#if USE_TDB
test_put_00_01_01
(
DB_DUP
|
DB_DUPSORT
,
DB_YESOVERWRITE
);
#endif
/* dup key uniq data */
test_dup_key
(
0
,
0
,
0
,
0
);
...
...
@@ -218,8 +234,8 @@ int main(int argc, const char *argv[]) {
test_dup_key
(
DB_DUP
,
DB_NOOVERWRITE
,
0
,
DB_KEYEXIST
);
#if USE_TDB
//
test_dup_key(DB_DUP | DB_DUPSORT, 0, EINVAL, EINVAL);
test_dup_key
(
DB_DUP
|
DB_DUPSORT
,
0
,
0
,
0
);
test_dup_key
(
DB_DUP
|
DB_DUPSORT
,
0
,
EINVAL
,
EINVAL
);
//
test_dup_key(DB_DUP | DB_DUPSORT, 0, 0, 0);
test_dup_key
(
DB_DUP
|
DB_DUPSORT
,
DB_YESOVERWRITE
,
0
,
0
);
#else
test_dup_key
(
DB_DUP
|
DB_DUPSORT
,
0
,
0
,
0
);
...
...
@@ -238,7 +254,7 @@ int main(int argc, const char *argv[]) {
#if USE_TDB
// test_dup_dup(DB_DUP | DB_DUPSORT, 0, EINVAL, EINVAL);
test_dup_dup
(
DB_DUP
|
DB_DUPSORT
,
0
,
0
,
DB_KEYEXIST
);
//
test_dup_dup(DB_DUP | DB_DUPSORT, 0, 0, DB_KEYEXIST);
test_dup_dup
(
DB_DUP
|
DB_DUPSORT
,
DB_YESOVERWRITE
,
0
,
0
);
#else
test_dup_dup
(
DB_DUP
|
DB_DUPSORT
,
0
,
0
,
DB_KEYEXIST
);
...
...
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