blob: 059f4d278deb8109e1d0b339df31a74792b65f66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# Run all tests in the current directory
#
# Tests are run in a sub-interpreter (if possible) to avoid
# interactions between tests.
lappend auto_path .
if {[info commands interp] eq ""} {
set rc 0
foreach script [lsort [glob *.test]] {
if {[catch {
exec [info nameofexecutable] $script >@stdout 2>@stderr
set rc 1
} msg opts]} {
puts "Failed: $script"
}
}
exit $rc
} else {
array set total {pass 0 fail 0 skip 0 tests 0}
foreach script [lsort [glob *.test]] {
set ::argv0 $script
set i [interp]
foreach var {argv0 auto_path} {
$i eval [list set $var [set ::$var]]
}
# Run the test
catch -exit {$i eval source $script} msg opts
if {[info returncode $opts(-code)] eq "error"} {
puts [format "%16s: --- error ($msg)" $script]
incr total(fail)
}
# Extract the counts
foreach var {pass fail skip tests} {
incr total($var) [$i eval "set testinfo(num$var)"]
}
$i delete
stdout flush
}
puts [string repeat = 73]
puts [format "%16s: Total %5d Passed %5d Skipped %5d Failed %5d" \
Totals $total(tests) $total(pass) $total(skip) $total(fail)]
if {$total(fail)} {
exit 1
}
}
|