From: Pieter Noordhuis Date: Wed, 19 May 2010 12:53:57 +0000 (+0200) Subject: Merge branch 'master' into integration X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/46b614edf7522e2bf8d3512fab347a9c9d4a1d70?hp=30dd89b6b72643beafa098344752812029ce7bd9 Merge branch 'master' into integration --- diff --git a/redis.c b/redis.c index b95eb455..c0f2d0fa 100644 --- a/redis.c +++ b/redis.c @@ -10633,7 +10633,7 @@ static void debugCommand(redisClient *c) { static void _redisAssert(char *estr, char *file, int line) { redisLog(REDIS_WARNING,"=== ASSERTION FAILED ==="); - redisLog(REDIS_WARNING,"==> %s:%d '%s' is not true\n",file,line,estr); + redisLog(REDIS_WARNING,"==> %s:%d '%s' is not true",file,line,estr); #ifdef HAVE_BACKTRACE redisLog(REDIS_WARNING,"(forcing SIGSEGV in order to print the stack trace)"); *((char*)-1) = 'x'; diff --git a/tests/support/test.tcl b/tests/support/test.tcl index c695c82f..83985e3e 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -7,7 +7,16 @@ proc test {name code okpattern} { # if {$::testnum < $::first || $::testnum > $::last} return puts -nonewline [format "#%03d %-68s " $::testnum $name] flush stdout - set retval [uplevel 1 $code] + if {[catch {set retval [uplevel 1 $code]} error]} { + puts "ERROR\n\nLogged warnings:" + foreach file [glob tests/tmp/server.[pid].*/stdout] { + set warnings [warnings_from_file $file] + if {[string length $warnings] > 0} { + puts $warnings + } + } + exit 1 + } if {$okpattern eq $retval || [string match $okpattern $retval]} { puts "PASSED" incr ::passed diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 8a7c3f1d..09a5804c 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]} {