X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/0f3010ab0d076d01b31019d902bfc94ca1e310d3..bb039e853df6c2754885c5cfb82dc3f7ea7d25b5:/tests/support/util.tcl diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 8a7c3f1d..36bc90d9 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -25,6 +25,23 @@ proc zlistAlikeSort {a b} { string compare [lindex $a 1] [lindex $b 1] } +# Return all log lines starting with the first line that contains a warning. +# Generally, this will be an assertion error with a stack trace. +proc warnings_from_file {filename} { + set lines [split [exec cat $filename] "\n"] + set matched 0 + set result {} + foreach line $lines { + if {[regexp {^\[\d+\]\s+\d+\s+\w+\s+\d{2}:\d{2}:\d{2} \#} $line]} { + set matched 1 + } + if {$matched} { + lappend result $line + } + } + join $result "\n" +} + # Return value for INFO property proc status {r property} { if {[regexp "\r\n$property:(.*?)\r\n" [$r info] _ value]} { @@ -171,3 +188,11 @@ proc createComplexDataset {r ops} { } } } + +proc formatCommand {args} { + set cmd "*[llength $args]\r\n" + foreach a $args { + append cmd "$[string length $a]\r\n$a\r\n" + } + set _ $cmd +}