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';
# 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
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]} {