Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
75398fbc
Commit
75398fbc
authored
Apr 29, 2009
by
antirez
Browse files
fuzz stresser implemented in redis-test
parent
dec423d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Changelog
View file @
75398fbc
2009-04-29 fixed for HT resize check 32bits overflow
2009-04-29 Check for fork() failure in background saving
2009-04-29 fix for the LZF off-by-one bug added
2009-04-28 print bytes used at exit on SHUTDOWN
2009-04-28 SMOVE test added
2009-04-28 SMOVE command implemented
2009-04-28 less CPU usage in command parsing, case insensitive config directives
2009-04-28 less CPU usage in command parsing, case insensitive config directives
2009-04-28 GETSET command doc added
2009-04-28 GETSET command doc added
2009-04-28 GETSET tests
2009-04-28 GETSET tests
...
...
test-redis.tcl
View file @
75398fbc
...
@@ -18,6 +18,26 @@ proc test {name code okpattern} {
...
@@ -18,6 +18,26 @@ proc test {name code okpattern} {
}
}
}
}
proc randstring
{
min max
{
type binary
}}
{
set len
[
expr
{
$min
+int
(
rand
()
*
(
$max-$min
+1
))}]
set output
{}
if
{
$type
eq
{
binary
}}
{
set minval 0
set maxval 255
}
elseif
{
$type
eq
{
alpha
}}
{
set minval 48
set maxval 122
}
elseif
{
$type
eq
{
compr
}}
{
set minval 48
set maxval 52
}
while
{
$len
}
{
append output
[
format
"%c"
[
expr
{
$minval
+int
(
rand
()
*
(
$maxval-$minval
+1
))}]]
incr len -1
}
return $output
}
proc main
{
server port
}
{
proc main
{
server port
}
{
set r
[
redis $server $port
]
set r
[
redis $server $port
]
set err
""
set err
""
...
@@ -690,6 +710,22 @@ proc main {server port} {
...
@@ -690,6 +710,22 @@ proc main {server port} {
format $err
format $err
}
{
ERR*
}
}
{
ERR*
}
foreach fuzztype
{
binary alpha compr
}
{
test
"FUZZ stresser with data model
$fuzztype
"
{
set err 0
for
{
set i 0
}
{
$i
< 1000
}
{
incr i
}
{
set fuzz
[
randstring 0 512 $fuzztype
]
$r set foo $fuzz
set got
[
$r
get foo
]
if
{
$got
ne $fuzz
}
{
incr err
break
}
}
format $err
}
{
0
}
}
# Leave the user with a clean DB before to exit
# Leave the user with a clean DB before to exit
test
{
FLUSHALL
}
{
test
{
FLUSHALL
}
{
$r flushall
$r flushall
...
...
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