diff options
Diffstat (limited to 'tests/support/util.tcl')
-rw-r--r-- | tests/support/util.tcl | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 236fad314..a36003029 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -602,15 +602,24 @@ proc stop_bg_complex_data {handle} { # Write num keys with the given key prefix and value size (in bytes). If idx is # given, it's the index (AKA level) used with the srv procedure and it specifies # to which Redis instance to write the keys. -proc populate {num {prefix key:} {size 3} {idx 0}} { - set rd [redis_deferring_client $idx] - for {set j 0} {$j < $num} {incr j} { - $rd set $prefix$j [string repeat A $size] +proc populate {num {prefix key:} {size 3} {idx 0} {prints false}} { + r $idx deferred 1 + if {$num > 16} {set pipeline 16} else {set pipeline $num} + set val [string repeat A $size] + for {set j 0} {$j < $pipeline} {incr j} { + r $idx set $prefix$j $val + if {$prints} {puts $j} } - for {set j 0} {$j < $num} {incr j} { - $rd read + for {} {$j < $num} {incr j} { + r $idx set $prefix$j $val + r $idx read + if {$prints} {puts $j} } - $rd close + for {set j 0} {$j < $pipeline} {incr j} { + r $idx read + if {$prints} {puts $j} + } + r $idx deferred 0 } proc get_child_pid {idx} { @@ -628,7 +637,7 @@ proc get_child_pid {idx} { } proc process_is_alive pid { - if {[catch {exec ps -p $pid} err]} { + if {[catch {exec ps -p $pid -f} err]} { return 0 } else { if {[string match "*<defunct>*" $err]} { return 0 } @@ -636,6 +645,20 @@ proc process_is_alive pid { } } +proc pause_process pid { + exec kill -SIGSTOP $pid + wait_for_condition 50 100 { + [string match {*T*} [lindex [exec ps j $pid] 16]] + } else { + puts [exec ps j $pid] + fail "process didn't stop" + } +} + +proc resume_process pid { + exec kill -SIGCONT $pid +} + proc cmdrstat {cmd r} { if {[regexp "\r\ncmdstat_$cmd:(.*?)\r\n" [$r info commandstats] _ value]} { set _ $value |