1 # TODO # test pipelining
9 proc test
{name code okpattern
} {
10 puts -nonewline [format "%-70s " $name]
12 set retval
[uplevel 1 $code]
13 if {$okpattern eq
$retval ||
[string match
$okpattern $retval]} {
17 puts "!! ERROR expected\n'$okpattern'\nbut got\n'$retval'"
22 proc randstring
{min max
{type
binary}} {
23 set len
[expr {$min+int
(rand
()*($max-$min+1))}]
25 if {$type eq
{binary}} {
28 } elseif
{$type eq
{alpha
}} {
31 } elseif
{$type eq
{compr
}} {
36 append output
[format "%c" [expr {$minval+int
(rand
()*($maxval-$minval+1))}]]
42 # Useful for some test
43 proc zlistAlikeSort
{a b
} {
44 if {[lindex $a 0] > [lindex $b 0]} {return 1}
45 if {[lindex $a 0] < [lindex $b 0]} {return -1}
46 string compare
[lindex $a 1] [lindex $b 1]
49 proc main
{server port
} {
50 set r
[redis
$server $port]
54 # The following AUTH test should be enabled only when requirepass
55 # <PASSWORD> is set in redis.conf and redis-server was started with
56 # redis.conf as the first argument.
58 #test {AUTH with requirepass in redis.conf} {
62 test
{DEL all keys to start with a clean DB
} {
63 foreach key
[$r keys
*] {$r del
$key}
67 test
{SET and GET an item
} {
72 test
{DEL against a single item
} {
81 list [$r del foo1 foo2 foo3 foo4
] [$r mget foo1 foo2 foo3
]
84 test
{KEYS with pattern
} {
85 foreach key
{key_x key_y key_z foo_a foo_b foo_c
} {
91 test
{KEYS to get all keys
} {
93 } {foo_a foo_b foo_c key_x key_y key_z
}
100 foreach key
[$r keys
*] {$r del
$key}
104 test
{Very big payload in GET
/SET
} {
105 set buf
[string repeat
"abcd" 1000000]
108 } [string repeat
"abcd" 1000000]
110 test
{SET
10000 numeric keys and access all them in reverse order
} {
111 for {set x
0} {$x < 10000} {incr x
} {
115 for {set x
9999} {$x >= 0} {incr x
-1} {
121 test
{DBSIZE should be
10001 now
} {
125 test
{INCR against non existing key
} {
127 append res
[$r incr novar
]
128 append res
[$r get novar
]
131 test
{INCR against key created by
incr itself
} {
135 test
{INCR against key originally
set with SET
} {
140 test
{INCR over
32bit value
} {
141 $r set novar
17179869184
145 test
{INCRBY over
32bit value with over
32bit increment
} {
146 $r set novar
17179869184
147 $r incrby novar
17179869184
150 test
{DECRBY over
32bit value with over
32bit increment
, negative res
} {
151 $r set novar
17179869184
152 $r decrby novar
17179869185
155 test
{SETNX target key missing
} {
156 $r setnx novar2 foobared
160 test
{SETNX target key exists
} {
161 $r setnx novar2 blabla
168 append res
[$r exists newkey
]
170 append res
[$r exists newkey
]
173 test
{Zero length value in key. SET
/GET
/EXISTS
} {
175 set res
[$r get emptykey
]
176 append res
[$r exists emptykey
]
178 append res
[$r exists emptykey
]
181 test
{Commands pipelining
} {
183 puts -nonewline $fd "SET k1 4\r\nxyzk\r\nGET k1\r\nPING\r\n"
186 append res
[string match OK
* [::redis::redis_read_reply $fd]]
187 append res
[::redis::redis_read_reply $fd]
188 append res
[string match PONG
* [::redis::redis_read_reply $fd]]
192 test
{Non existing command
} {
193 catch {$r foobaredcommand
} err
194 string match ERR
* $err
197 test
{Basic LPUSH
, RPUSH
, LLENGTH
, LINDEX
} {
201 set res
[$r llen mylist
]
202 append res
[$r lindex mylist
0]
203 append res
[$r lindex mylist
1]
204 append res
[$r lindex mylist
2]
212 test
{Create a long
list and check every single element with LINDEX
} {
214 for {set i
0} {$i < 1000} {incr i
} {
217 for {set i
0} {$i < 1000} {incr i
} {
218 if {[$r lindex mylist
$i] eq
$i} {incr ok
}
219 if {[$r lindex mylist
[expr (-$i)-1]] eq
[expr 999-$i]} {
226 test
{Test elements with LINDEX in random access
} {
228 for {set i
0} {$i < 1000} {incr i
} {
229 set rint
[expr int
(rand
()*1000)]
230 if {[$r lindex mylist
$rint] eq
$rint} {incr ok
}
231 if {[$r lindex mylist
[expr (-$rint)-1]] eq
[expr 999-$rint]} {
238 test
{LLEN against non-list value
error} {
241 catch {$r llen mylist
} err
245 test
{LINDEX against non-list value
error} {
246 catch {$r lindex mylist
0} err
250 test
{LPUSH against non-list value
error} {
251 catch {$r lpush mylist
0} err
255 test
{RPUSH against non-list value
error} {
256 catch {$r rpush mylist
0} err
260 test
{RPOPLPUSH base case
} {
266 set v1
[$r rpoplpush mylist newlist
]
267 set v2
[$r rpoplpush mylist newlist
]
268 set l1
[$r lrange mylist
0 -1]
269 set l2
[$r lrange newlist
0 -1]
273 test
{RPOPLPUSH with the same
list as src and dst
} {
278 set l1
[$r lrange mylist
0 -1]
279 set v
[$r rpoplpush mylist mylist
]
280 set l2
[$r lrange mylist
0 -1]
282 } {{a b c
} c
{c a b
}}
284 test
{RPOPLPUSH target
list already exists
} {
292 set v1
[$r rpoplpush mylist newlist
]
293 set v2
[$r rpoplpush mylist newlist
]
294 set l1
[$r lrange mylist
0 -1]
295 set l2
[$r lrange newlist
0 -1]
297 } {d c
{a b
} {c d x
}}
299 test
{RPOPLPUSH against non existing key
} {
302 set v1
[$r rpoplpush mylist newlist
]
303 list $v1 [$r exists mylist
] [$r exists newlist
]
306 test
{RPOPLPUSH against non
list src key
} {
310 catch {$r rpoplpush mylist newlist
} err
311 list [$r type mylist
] [$r exists newlist
] [string range
$err 0 2]
314 test
{RPOPLPUSH against non
list dst key
} {
322 catch {$r rpoplpush mylist newlist
} err
323 list [$r lrange mylist
0 -1] [$r type newlist
] [string range
$err 0 2]
324 } {{a b c d
} string ERR
}
326 test
{RENAME basic usage
} {
328 $r rename mykey mykey1
329 $r rename mykey1 mykey2
333 test
{RENAME
source key should no longer exist
} {
337 test
{RENAME against already existing key
} {
340 $r rename mykey2 mykey
341 set res
[$r get mykey
]
342 append res
[$r exists mykey2
]
345 test
{RENAMENX basic usage
} {
349 $r renamenx mykey mykey2
350 set res
[$r get mykey2
]
351 append res
[$r exists mykey
]
354 test
{RENAMENX against already existing key
} {
357 $r renamenx mykey mykey2
360 test
{RENAMENX against already existing key
(2)} {
361 set res
[$r get mykey
]
362 append res
[$r get mykey2
]
365 test
{RENAME against non existing
source key
} {
366 catch {$r rename nokey foobar
} err
370 test
{RENAME where
source and dest key is the same
} {
371 catch {$r rename mykey mykey
} err
375 test
{DEL all keys again
(DB
0)} {
376 foreach key
[$r keys
*] {
382 test
{DEL all keys again
(DB
1)} {
384 foreach key
[$r keys
*] {
392 test
{MOVE basic usage
} {
396 lappend res
[$r exists mykey
]
397 lappend res
[$r dbsize
]
399 lappend res
[$r get mykey
]
400 lappend res
[$r dbsize
]
403 } [list 0 0 foobar
1]
405 test
{MOVE against key existing in the target DB
} {
410 test
{SET
/GET keys in different DBs
} {
418 lappend res
[$r get a
]
419 lappend res
[$r get b
]
421 lappend res
[$r get a
]
422 lappend res
[$r get b
]
425 } {hello world foo bared
}
427 test
{Basic LPOP
/RPOP
} {
432 list [$r lpop mylist
] [$r rpop mylist
] [$r lpop mylist
] [$r llen mylist
]
435 test
{LPOP
/RPOP against empty
list} {
439 test
{LPOP against non
list value
} {
441 catch {$r lpop notalist
} err
445 test
{Mass LPUSH
/LPOP
} {
447 for {set i
0} {$i < 1000} {incr i
} {
452 for {set i
0} {$i < 500} {incr i
} {
453 incr sum2
[$r lpop mylist
]
454 incr sum2
[$r rpop mylist
]
459 test
{LRANGE basics
} {
460 for {set i
0} {$i < 10} {incr i
} {
463 list [$r lrange mylist
1 -2] \
464 [$r lrange mylist
-3 -1] \
465 [$r lrange mylist
4 4]
466 } {{1 2 3 4 5 6 7 8} {7 8 9} 4}
468 test
{LRANGE inverted indexes
} {
472 test
{LRANGE out of range indexes including the full
list} {
473 $r lrange mylist
-1000 1000
474 } {0 1 2 3 4 5 6 7 8 9}
476 test
{LRANGE against non existing key
} {
477 $r lrange nosuchkey
0 1
480 test
{LTRIM basics
} {
482 for {set i
0} {$i < 100} {incr i
} {
486 $r lrange mylist
0 -1
491 $r lset mylist
-1 bar
492 $r lrange mylist
0 -1
495 test
{LSET out of range index
} {
496 catch {$r lset mylist
10 foo
} err
500 test
{LSET against non existing key
} {
501 catch {$r lset nosuchkey
10 foo
} err
505 test
{LSET against non
list value
} {
507 catch {$r lset nolist
0 foo
} err
511 test
{SADD
, SCARD
, SISMEMBER
, SMEMBERS basics
} {
514 list [$r scard myset
] [$r sismember myset foo
] \
515 [$r sismember myset bar
] [$r sismember myset bla
] \
516 [lsort [$r smembers myset
]]
517 } {2 1 1 0 {bar foo
}}
519 test
{SADD adding the same element multiple times
} {
526 test
{SADD against non
set} {
527 catch {$r sadd mylist foo
} err
534 lsort [$r smembers myset
]
537 test
{Mass SADD and SINTER with two sets
} {
538 for {set i
0} {$i < 1000} {incr i
} {
540 $r sadd set2
[expr $i+995]
542 lsort [$r sinter set1 set2
]
543 } {995 996 997 998 999}
545 test
{SUNION with two sets
} {
546 lsort [$r sunion set1 set2
]
547 } [lsort -uniq "[$r smembers set1] [$r smembers set2]"]
549 test
{SINTERSTORE with two sets
} {
550 $r sinterstore setres set1 set2
551 lsort [$r smembers setres
]
552 } {995 996 997 998 999}
554 test
{SUNIONSTORE with two sets
} {
555 $r sunionstore setres set1 set2
556 lsort [$r smembers setres
]
557 } [lsort -uniq "[$r smembers set1] [$r smembers set2]"]
559 test
{SINTER against three sets
} {
564 lsort [$r sinter set1 set2 set3
]
567 test
{SINTERSTORE with three sets
} {
568 $r sinterstore setres set1 set2 set3
569 lsort [$r smembers setres
]
572 test
{SUNION with non existing keys
} {
573 lsort [$r sunion nokey1 set1 set2 nokey2
]
574 } [lsort -uniq "[$r smembers set1] [$r smembers set2]"]
576 test
{SDIFF with two sets
} {
577 for {set i
5} {$i < 1000} {incr i
} {
580 lsort [$r sdiff set1 set4
]
583 test
{SDIFF with three sets
} {
585 lsort [$r sdiff set1 set4 set5
]
588 test
{SDIFFSTORE with three sets
} {
589 $r sdiffstore sres set1 set4 set5
590 lsort [$r smembers sres
]
598 list [lsort [list [$r spop myset
] [$r spop myset
] [$r spop myset
]]] [$r scard myset
]
601 test
{SAVE
- make sure there are all the types as values
} {
602 # Wait for a background saving in progress to terminate
605 if {[string match
{*bgsave_in_progress
:1*} $i]} {
606 puts -nonewline "\nWaiting for background save to finish... "
613 $r lpush mysavelist hello
614 $r lpush mysavelist world
616 $r set mynormalkey
{blablablba
}
617 $r zadd mytestzset a
10
618 $r zadd mytestzset b
20
619 $r zadd mytestzset c
30
628 unset -nocomplain myset
630 for {set i
0} {$i < 100} {incr i
} {
631 set myset
([$r srandmember myset
]) 1
633 lsort [array names myset
]
636 test
{Create a random
list} {
638 array set seenrand
{}
639 for {set i
0} {$i < 10000} {incr i
} {
641 # Make sure all the weights are different because
642 # Redis does not use a stable sort but Tcl does.
643 set rint
[expr int
(rand
()*1000000)]
644 if {![info exists seenrand
($rint)]} break
646 set seenrand
($rint) x
648 $r set weight_
$i $rint
649 lappend tosort
[list $i $rint]
651 set sorted
[lsort -index 1 -real $tosort]
653 for {set i
0} {$i < 10000} {incr i
} {
654 lappend res
[lindex $sorted $i 0]
659 test
{SORT with BY against the newly created
list} {
660 $r sort tosort
{BY weight_
*}
663 test
{SORT direct
, numeric
, against the newly created
list} {
665 } [lsort -integer $res]
667 test
{SORT decreasing sort
} {
668 $r sort tosort
{DESC
}
669 } [lsort -decreasing -integer $res]
671 test
{SORT speed
, sorting
10000 elements
list using BY
, 100 times
} {
672 set start
[clock clicks
-milliseconds]
673 for {set i
0} {$i < 100} {incr i
} {
674 set sorted
[$r sort tosort
{BY weight_
* LIMIT
0 10}]
676 set elapsed
[expr [clock clicks
-milliseconds]-$start]
677 puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
682 test
{SORT speed
, sorting
10000 elements
list directly
, 100 times
} {
683 set start
[clock clicks
-milliseconds]
684 for {set i
0} {$i < 100} {incr i
} {
685 set sorted
[$r sort tosort
{LIMIT
0 10}]
687 set elapsed
[expr [clock clicks
-milliseconds]-$start]
688 puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
693 test
{SORT speed
, pseudo-sorting
10000 elements
list, BY
<const
>, 100 times
} {
694 set start
[clock clicks
-milliseconds]
695 for {set i
0} {$i < 100} {incr i
} {
696 set sorted
[$r sort tosort
{BY nokey LIMIT
0 10}]
698 set elapsed
[expr [clock clicks
-milliseconds]-$start]
699 puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
704 test
{SORT regression
for issue
#19, sorting floats} {
706 foreach x
{1.1 5.10 3.10 7.44 2.1 5.75 6.12 0.25 1.15} {
710 } [lsort -real {1.1 5.10 3.10 7.44 2.1 5.75 6.12 0.25 1.15}]
712 test
{SORT with GET
#} {
717 $r mset weight_1
10 weight_2
5 weight_3
30
718 $r sort mylist BY weight_
* GET
#
721 test
{LREM
, remove all the occurrences
} {
725 $r rpush mylist foobar
726 $r rpush mylist foobared
731 set res
[$r lrem mylist
0 bar
]
732 list [$r lrange mylist
0 -1] $res
733 } {{foo foobar foobared zap test foo
} 2}
735 test
{LREM
, remove the first occurrence
} {
736 set res
[$r lrem mylist
1 foo
]
737 list [$r lrange mylist
0 -1] $res
738 } {{foobar foobared zap test foo
} 1}
740 test
{LREM
, remove non existing element
} {
741 set res
[$r lrem mylist
1 nosuchelement
]
742 list [$r lrange mylist
0 -1] $res
743 } {{foobar foobared zap test foo
} 0}
745 test
{LREM
, starting from tail with negative count
} {
749 $r rpush mylist foobar
750 $r rpush mylist foobared
756 set res
[$r lrem mylist
-1 bar
]
757 list [$r lrange mylist
0 -1] $res
758 } {{foo bar foobar foobared zap test foo foo
} 1}
760 test
{LREM
, starting from tail with negative count
(2)} {
761 set res
[$r lrem mylist
-2 foo
]
762 list [$r lrange mylist
0 -1] $res
763 } {{foo bar foobar foobared zap test
} 2}
765 test
{LREM
, deleting objects that may be encoded as integers
} {
766 $r lpush myotherlist
1
767 $r lpush myotherlist
2
768 $r lpush myotherlist
3
769 $r lrem myotherlist
1 2
780 test
{MGET against non existing key
} {
781 $r mget foo baazz bar
784 test
{MGET against non-string key
} {
787 $r mget foo baazz bar myset
796 for {set i
0} {$i < 100} {incr i
} {
797 set rkey
[$r randomkey
]
798 if {$rkey eq
{foo
}} {
801 if {$rkey eq
{bar
}} {
805 list $foo_seen $bar_seen
808 test
{RANDOMKEY against empty DB
} {
813 test
{RANDOMKEY regression
1} {
820 test
{GETSET
(set new value
)} {
821 list [$r getset foo xyz
] [$r get foo
]
824 test
{GETSET
(replace old value
)} {
826 list [$r getset foo xyz
] [$r get foo
]
829 test
{SMOVE basics
} {
836 $r smove myset1 myset2 a
837 list [lsort [$r smembers myset2
]] [lsort [$r smembers myset1
]]
840 test
{SMOVE non existing key
} {
841 list [$r smove myset1 myset2 foo
] [lsort [$r smembers myset2
]] [lsort [$r smembers myset1
]]
842 } {0 {a x y z
} {b c
}}
844 test
{SMOVE non existing src
set} {
845 list [$r smove noset myset2 foo
] [lsort [$r smembers myset2
]]
848 test
{SMOVE non existing dst
set} {
849 list [$r smove myset2 myset3 y
] [lsort [$r smembers myset2
]] [lsort [$r smembers myset3
]]
852 test
{SMOVE wrong src key type
} {
854 catch {$r smove x myset2 foo
} err
858 test
{SMOVE wrong dst key type
} {
860 catch {$r smove myset2 x foo
} err
864 test
{MSET base case
} {
865 $r mset x
10 y
"foo bar" z
"x x x x x x x\n\n\r\n"
867 } [list 10 {foo bar
} "x x x x x x x\n\n\r\n"]
869 test
{MSET wrong number of args
} {
870 catch {$r mset x
10 y
"foo bar" z
} err
874 test
{MSETNX with already existent key
} {
875 list [$r msetnx x1 xxx y2 yyy x
20] [$r exists x1
] [$r exists y2
]
878 test
{MSETNX with not existing keys
} {
879 list [$r msetnx x1 xxx y2 yyy
] [$r get x1
] [$r get y2
]
882 test
{ZSET basic ZADD and score
update} {
886 set aux1
[$r zrange ztmp
0 -1]
888 set aux2
[$r zrange ztmp
0 -1]
895 for {set i
0} {$i < 1000} {incr i
} {
896 set score
[expr rand
()]
898 $r zadd zscoretest
$score $i
900 for {set i
0} {$i < 1000} {incr i
} {
901 if {[$r zscore zscoretest
$i] != [lindex $aux $i]} {
902 set err
"Expected score was [lindex $aux $i] but got [$r zscore zscoretest $i] for element $i"
909 test
{ZRANGE and ZREVRANGE
} {
910 list [$r zrange ztmp
0 -1] [$r zrevrange ztmp
0 -1]
913 test
{ZSETs stress tester
- sorting is working well?
} {
915 for {set test
0} {$test < 2} {incr test
} {
916 unset -nocomplain auxarray
917 array set auxarray
{}
920 for {set i
0} {$i < 1000} {incr i
} {
922 set score
[expr rand
()]
924 set score
[expr int
(rand
()*10)]
926 set auxarray
($i) $score
927 $r zadd myzset
$score $i
929 if {[expr rand
()] < .2} {
930 set j
[expr int
(rand
()*1000)]
932 set score
[expr rand
()]
934 set score
[expr int
(rand
()*10)]
936 set auxarray
($j) $score
937 $r zadd myzset
$score $j
940 foreach {item score
} [array get auxarray
] {
941 lappend auxlist
[list $score $item]
943 set sorted
[lsort -command zlistAlikeSort
$auxlist]
946 lappend auxlist
[lindex $x 1]
948 set fromredis
[$r zrange myzset
0 -1]
950 for {set i
0} {$i < [llength $fromredis]} {incr i
} {
951 if {[lindex $fromredis $i] != [lindex $auxlist $i]} {
959 test
{ZINCRBY
- can create a new sorted
set} {
961 $r zincrby zset
1 foo
962 list [$r zrange zset
0 -1] [$r zscore zset foo
]
965 test
{ZINCRBY
- increment and decrement
} {
966 $r zincrby zset
2 foo
967 $r zincrby zset
1 bar
968 set v1
[$r zrange zset
0 -1]
969 $r zincrby zset
10 bar
970 $r zincrby zset
-5 foo
971 $r zincrby zset
-5 bar
972 set v2
[$r zrange zset
0 -1]
973 list $v1 $v2 [$r zscore zset foo
] [$r zscore zset bar
]
974 } {{bar foo
} {foo bar
} -2 6}
976 test
{EXPIRE
- don't
set timeouts multiple times
} {
978 set v1
[$r expire x
5]
980 set v3
[$r expire x
10]
985 test
{EXPIRE
- It should be still possible to
read 'x'
} {
989 test
{EXPIRE
- After
6 seconds the key should no longer be here
} {
991 list [$r get x
] [$r exists x
]
994 test
{EXPIRE
- Delete on write policy
} {
1002 test
{EXPIREAT
- Check
for EXPIRE alike behavior
} {
1005 $r expireat x
[expr [clock seconds
]+15]
1009 test
{ZSETs skiplist implementation backlink consistency test
} {
1012 for {set j
0} {$j < $elements} {incr j
} {
1013 $r zadd myzset
[expr rand
()] "Element-$j"
1014 $r zrem myzset
"Element-[expr int(rand()*$elements)]"
1016 set l1
[$r zrange myzset
0 -1]
1017 set l2
[$r zrevrange myzset
0 -1]
1018 for {set j
0} {$j < [llength $l1]} {incr j
} {
1019 if {[lindex $l1 $j] ne
[lindex $l2 end-
$j]} {
1026 foreach fuzztype
{binary alpha compr
} {
1027 test
"FUZZ stresser with data model $fuzztype" {
1029 for {set i
0} {$i < 10000} {incr i
} {
1030 set fuzz
[randstring
0 512 $fuzztype]
1032 set got
[$r get foo
]
1033 if {$got ne
$fuzz} {
1034 set err
[list $fuzz $got]
1042 # Leave the user with a clean DB before to exit
1047 lappend aux
[$r dbsize
]
1050 lappend aux
[$r dbsize
]
1053 test
{Perform a final SAVE to leave a clean DB on disk
} {
1057 puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed"
1058 if {$::failed > 0} {
1059 puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n"
1069 set randkey
[expr int
(rand
()*10000)]
1070 set randval
[expr int
(rand
()*10000)]
1071 set randidx0
[expr int
(rand
()*10)]
1072 set randidx1
[expr int
(rand
()*10)]
1073 set cmd
[expr int
(rand
()*20)]
1075 if {$cmd == 0} {$r set $randkey $randval}
1076 if {$cmd == 1} {$r get
$randkey}
1077 if {$cmd == 2} {$r incr $randkey}
1078 if {$cmd == 3} {$r lpush
$randkey $randval}
1079 if {$cmd == 4} {$r rpop
$randkey}
1080 if {$cmd == 5} {$r del
$randkey}
1081 if {$cmd == 6} {$r llen
$randkey}
1082 if {$cmd == 7} {$r lrange $randkey $randidx0 $randidx1}
1083 if {$cmd == 8} {$r ltrim
$randkey $randidx0 $randidx1}
1084 if {$cmd == 9} {$r lindex $randkey $randidx0}
1085 if {$cmd == 10} {$r lset $randkey $randidx0 $randval}
1086 if {$cmd == 11} {$r sadd
$randkey $randval}
1087 if {$cmd == 12} {$r srem
$randkey $randval}
1088 if {$cmd == 13} {$r smove
$randkey $randval}
1089 if {$cmd == 14} {$r scard
$randkey}
1090 if {$cmd == 15} {$r expire
$randkey [expr $randval%60]}
1098 # Before to run the test check if DB 9 and DB 10 are empty
1101 set db9size
[$r dbsize
]
1103 set db10size
[$r dbsize
]
1104 if {$db9size != 0 ||
$db10size != 0} {
1105 puts "Can't run the tests against DB 9 and 10: DBs are not empty."
1113 if {[llength $argv] == 0} {
1115 } elseif
{[llength $argv] == 1 && [lindex $argv 0] eq
{stress
}} {
1118 main
[lindex $argv 0] [lindex $argv 1]