From 9cf9e6f197a0270a86b26ddfca65a6faa72da893 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Fri, 14 May 2010 20:48:57 +0200 Subject: [PATCH] proc to retrieve values from INFO properties --- tests/support/util.tcl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 3f4a4259..a084df90 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -25,10 +25,16 @@ proc zlistAlikeSort {a b} { string compare [lindex $a 1] [lindex $b 1] } +# Return value for INFO property +proc status {r property} { + if {[regexp "\r\n$property:(.*?)\r\n" [$r info] _ value]} { + set _ $value + } +} + proc waitForBgsave r { while 1 { - set i [$r info] - if {[string match {*bgsave_in_progress:1*} $i]} { + if {[status r bgsave_in_progress] eq 1} { puts -nonewline "\nWaiting for background save to finish... " flush stdout after 1000 @@ -40,8 +46,7 @@ proc waitForBgsave r { proc waitForBgrewriteaof r { while 1 { - set i [$r info] - if {[string match {*bgrewriteaof_in_progress:1*} $i]} { + if {[status r bgrewriteaof_in_progress] eq 1} { puts -nonewline "\nWaiting for background AOF rewrite to finish... " flush stdout after 1000