fuzz stresser implemented in redis-test

This commit is contained in:
antirez 2009-04-29 19:49:19 +02:00
parent dec423d9cf
commit 75398fbcae
2 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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 GETSET command doc added
2009-04-28 GETSET tests

View File

@ -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} {
set r [redis $server $port]
set err ""
@ -690,6 +710,22 @@ proc main {server port} {
format $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
test {FLUSHALL} {
$r flushall