"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/support/util.tcl" between
redis-6.0.7.tar.gz and redis-6.0.8.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

util.tcl  (redis-6.0.7):util.tcl  (redis-6.0.8)
skipping to change at line 102 skipping to change at line 102
} }
proc wait_for_ofs_sync {r1 r2} { proc wait_for_ofs_sync {r1 r2} {
wait_for_condition 50 100 { wait_for_condition 50 100 {
[status $r1 master_repl_offset] eq [status $r2 master_repl_offset] [status $r1 master_repl_offset] eq [status $r2 master_repl_offset]
} else { } else {
fail "replica didn't sync in time" fail "replica didn't sync in time"
} }
} }
proc wait_done_loading r {
wait_for_condition 50 100 {
[catch {$r ping} e] == 0
} else {
fail "Loading DB is taking too much time."
}
}
# count current log lines in server's stdout # count current log lines in server's stdout
proc count_log_lines {srv_idx} { proc count_log_lines {srv_idx} {
set _ [exec wc -l < [srv $srv_idx stdout]] set _ [exec wc -l < [srv $srv_idx stdout]]
} }
# verify pattern exists in server's sdtout after a certain line number # verify pattern exists in server's sdtout after a certain line number
proc verify_log_message {srv_idx pattern from_line} { proc verify_log_message {srv_idx pattern from_line} {
incr from_line incr from_line
set result [exec tail -n +$from_line < [srv $srv_idx stdout]] set result [exec tail -n +$from_line < [srv $srv_idx stdout]]
if {![string match $pattern $result]} { if {![string match $pattern $result]} {
skipping to change at line 141 skipping to change at line 149
incr next_line incr next_line
} }
incr retry -1 incr retry -1
after $delay after $delay
} }
if {$retry == 0} { if {$retry == 0} {
fail "log message of '$patterns' not found in $stdout after line: $from_ line till line: [expr $next_line -1]" fail "log message of '$patterns' not found in $stdout after line: $from_ line till line: [expr $next_line -1]"
} }
} }
# write line to server log file
proc write_log_line {srv_idx msg} {
set logfile [srv $srv_idx stdout]
set fd [open $logfile "a+"]
puts $fd "### $msg"
close $fd
}
# Random integer between 0 and max (excluded). # Random integer between 0 and max (excluded).
proc randomInt {max} { proc randomInt {max} {
expr {int(rand()*$max)} expr {int(rand()*$max)}
} }
# Random signed integer between -max and max (both extremes excluded). # Random signed integer between -max and max (both extremes excluded).
proc randomSignedInt {max} { proc randomSignedInt {max} {
set i [randomInt $max] set i [randomInt $max]
if {rand() > 0.5} { if {rand() > 0.5} {
set i -$i set i -$i
skipping to change at line 419 skipping to change at line 435
default {set colorcode {37}} default {set colorcode {37}}
} }
if {$colorcode ne {}} { if {$colorcode ne {}} {
return "\033\[$b;${colorcode};49m$str\033\[0m" return "\033\[$b;${colorcode};49m$str\033\[0m"
} }
} else { } else {
return $str return $str
} }
} }
proc find_valgrind_errors {stderr} {
set fd [open $stderr]
set buf [read $fd]
close $fd
# Look for stack trace (" at 0x") and other errors (Invalid, Mismatched, etc
).
# Look for "Warnings", but not the "set address range perms". These don't in
dicate any real concern.
# Look for the absense of a leak free summary (happens when redis isn't term
inated properly).
if {[regexp -- { at 0x} $buf] ||
[regexp -- {^(?=.*Warning)(?:(?!set address range perms).)*$} $buf] ||
[regexp -- {Invalid} $buf] ||
[regexp -- {Mismatched} $buf] ||
[regexp -- {uninitialized} $buf] ||
[regexp -- {has a fishy} $buf] ||
[regexp -- {overlap} $buf] ||
(![regexp -- {definitely lost: 0 bytes} $buf] &&
![regexp -- {no leaks are possible} $buf])} {
return $buf
}
return ""
}
# Execute a background process writing random data for the specified number # Execute a background process writing random data for the specified number
# of seconds to the specified Redis instance. # of seconds to the specified Redis instance.
proc start_write_load {host port seconds} { proc start_write_load {host port seconds} {
set tclsh [info nameofexecutable] set tclsh [info nameofexecutable]
exec $tclsh tests/helpers/gen_write_load.tcl $host $port $seconds $::tls & exec $tclsh tests/helpers/gen_write_load.tcl $host $port $seconds $::tls &
} }
# Stop a process generating write load executed with start_write_load. # Stop a process generating write load executed with start_write_load.
proc stop_write_load {handle} { proc stop_write_load {handle} {
catch {exec /bin/kill -9 $handle} catch {exec /bin/kill -9 $handle}
skipping to change at line 458 skipping to change at line 497
# of ops to the specified Redis instance. # of ops to the specified Redis instance.
proc start_bg_complex_data {host port db ops} { proc start_bg_complex_data {host port db ops} {
set tclsh [info nameofexecutable] set tclsh [info nameofexecutable]
exec $tclsh tests/helpers/bg_complex_data.tcl $host $port $db $ops $::tls & exec $tclsh tests/helpers/bg_complex_data.tcl $host $port $db $ops $::tls &
} }
# Stop a process generating write load executed with start_bg_complex_data. # Stop a process generating write load executed with start_bg_complex_data.
proc stop_bg_complex_data {handle} { proc stop_bg_complex_data {handle} {
catch {exec /bin/kill -9 $handle} catch {exec /bin/kill -9 $handle}
} }
proc populate {num prefix size} {
set rd [redis_deferring_client]
for {set j 0} {$j < $num} {incr j} {
$rd set $prefix$j [string repeat A $size]
}
for {set j 0} {$j < $num} {incr j} {
$rd read
}
$rd close
}
proc get_child_pid {idx} {
set pid [srv $idx pid]
if {[string match {*Darwin*} [exec uname -a]]} {
set fd [open "|pgrep -P $pid" "r"]
set child_pid [string trim [lindex [split [read $fd] \n] 0]]
} else {
set fd [open "|ps --ppid $pid -o pid" "r"]
set child_pid [string trim [lindex [split [read $fd] \n] 1]]
}
close $fd
return $child_pid
}
 End of changes. 4 change blocks. 
0 lines changed or deleted 42 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)