]>
Commit | Line | Data |
---|---|---|
98578b57 PN |
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 | |
ab72b483 | 8 | puts -nonewline [format "#%03d %-68s " $::testnum $name] |
98578b57 | 9 | flush stdout |
fdfb02e7 PN |
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 | } | |
98578b57 PN |
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 | } |