mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
fuzz stresser implemented in redis-test
This commit is contained in:
parent
dec423d9cf
commit
75398fbcae
@ -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 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
|
||||||
|
@ -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} {
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user