From 24bd9b19f60712f635ce512a7fa29d6de2d98e39 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 28 Jun 2016 09:42:20 +0200 Subject: Test: new randomized stress tester for #3343 alike bugs. --- tests/unit/type/list-3.tcl | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/unit/type/list-3.tcl b/tests/unit/type/list-3.tcl index 7888409ec..b5bd48cb0 100644 --- a/tests/unit/type/list-3.tcl +++ b/tests/unit/type/list-3.tcl @@ -27,8 +27,33 @@ start_server { } {PONG} test {Stress tester for #3343-alike bugs} { - for {set j 0} {$j < 100} {incr j} { - puts [randomInt 10] + r del key + for {set j 0} {$j < 10000} {incr j} { + set op [randomInt 6] + set small_signed_count [expr 5-[randomInt 10]] + if {[randomInt 2] == 0} { + set ele [randomInt 1000] + } else { + set ele [string repeat x [randomInt 10000]][randomInt 1000] + } + switch $op { + 0 {r lpush key $ele} + 1 {r rpush key $ele} + 2 {r lpop key} + 3 {r rpop key} + 4 { + catch {r lset key $small_signed_count $ele} + } + 5 { + set otherele [randomInt 1000] + if {[randomInt 2] == 0} { + set where before + } else { + set where after + } + r linsert key $where $otherele $ele + } + } } } -- cgit v1.2.1