]> git.saurik.com Git - redis.git/blobdiff - tests/support/test.tcl
print warnings in redis log when a test raises an exception (very likely to be caused...
[redis.git] / tests / support / test.tcl
index c695c82fa30cb4e1f232ba51b679ae5c6e153186..83985e3e1e5aa71b6e22dd318ac2ee25aef5506f 100644 (file)
@@ -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