]> git.saurik.com Git - redis.git/blob - tests/support/test.tcl
Merge branch 'master' into integration
[redis.git] / tests / support / test.tcl
1 set ::passed 0
2 set ::failed 0
3 set ::testnum 0
4
5 proc test {name code okpattern} {
6 incr ::testnum
7 # if {$::testnum < $::first || $::testnum > $::last} return
8 puts -nonewline [format "#%03d %-68s " $::testnum $name]
9 flush stdout
10 if {[catch {set retval [uplevel 1 $code]} error]} {
11 puts "ERROR\n\nLogged warnings:"
12 foreach file [glob tests/tmp/server.[pid].*/stdout] {
13 set warnings [warnings_from_file $file]
14 if {[string length $warnings] > 0} {
15 puts $warnings
16 }
17 }
18 exit 1
19 }
20 if {$okpattern eq $retval || [string match $okpattern $retval]} {
21 puts "PASSED"
22 incr ::passed
23 } else {
24 puts "!! ERROR expected\n'$okpattern'\nbut got\n'$retval'"
25 incr ::failed
26 }
27 if {$::traceleaks} {
28 if {![string match {*0 leaks*} [exec leaks redis-server]]} {
29 puts "--------- Test $::testnum LEAKED! --------"
30 exit 1
31 }
32 }
33 }