5 #
If tracing has been enabled at the top level
, then turn it
on here
11 # After these many
seconds of execution the test script is aborted
13 # This is to handle deadlocks. We don
't reset the timeout when a match is
14 # found to avoid hanging in case of a testcase sending matches in an
16 # (not unlikely as it seems, think about flash movies...)
18 # Expressed in seconds.
26 # testcases is set by the Makefile in the site.exp data file.
27 foreach file $testcases {
29 verbose "Running test $file"
31 # spawn the executable and look for the DejaGnu output messages from the
34 # this version of the call allows use of 'wait
' to check return code
35 # -open [open "|cmd" "r"] doesn't work
for that
37 # Ignore SIGHUP or we
'd get a lot of them on Debian stable
38 set PID [spawn -noecho -ignore SIGHUP ./$file]
41 -re "^\[^\n]*NOTE:\[^\n]*\n" {
42 regsub ".*NOTE: " $expect_out(0,string) "" output
43 set output [string range $output 0 end-2]
44 verbose "${file} $output"
45 # notes tipically come from the test runner, so we'll trust it to mean
46 # things are someone not too bad...
50 -re
"^\[^\n]* ERROR:\[^\n]*\n" {
51 regsub
".* ERROR: " $expect_out(0,string) "" output
52 set output
[string range $output
0 end
-2]
53 verbose
"ERROR: ${file}: $output"
54 exp_continue
-continue_timer
56 -re
"^\[^\n]*XPASSED:\[^\n]*\n" {
57 regsub
".*XPASSED: " $expect_out(0,string) "" output
58 set output
[string range $output
0 end
-2]
59 xpass
"${file}: $output"
60 exp_continue
-continue_timer
62 -re
"^\[^\n]*PASSED:\[^\n]*\n" {
63 regsub
".*PASSED: " $expect_out(0,string) "" output
64 set output
[string range $output
0 end
-2]
65 pass
"${file}: $output"
66 exp_continue
-continue_timer
68 -re
"^\[^\n]*XFAILED:\[^\n]*\n" {
69 regsub
".*XFAILED: " $expect_out(0,string) "" output
70 set output
[string range $output
0 end
-2]
71 xfail
"${file}: $output"
72 exp_continue
-continue_timer
74 -re
"^\[^\n]*FAILED:\[^\n]*\n" {
75 regsub
".*FAILED: " $expect_out(0,string) "" output
76 set output
[string range $output
0 end
-2]
77 fail
"${file}: $output"
78 exp_continue
-continue_timer
80 -re
"^\[^\n]*UNTESTED:\[^\n]*\n" {
81 regsub
".*UNTESTED: " $expect_out(0,string) "" output
82 set output
[string range $output
0 end
-2]
83 untested
"${file}: $output"
84 exp_continue
-continue_timer
86 -re
"^\[^\n]*UNRESOLVED:\[^\n]*\n" {
87 regsub
".*UNRESOLVED: " $expect_out(0,string) "" output
88 set output
[string range $output
0 end
-2]
89 unresolved
"${file}: $output"
90 exp_continue
-continue_timer
93 # just remove non
-matching lines
!
94 exp_continue
-continue_timer
97 # unresolved
"${file} died prematurely"
99 #
return "${file} died prematurely"
102 fail
"Test case ${file} still running after ${timeout} seconds, killing it (deadlock?)"
109 # wait
for the process to coplete to
114 #
set i
0; foreach j $retcode
{ print
"${file} wait($i) $j"; incr i }
116 # This snippet catches segfaults and aborts.
117 # Would also catch SIGHUP
, but we
're ignoring them
118 # as on Debian Stable we unexpectedly get them for no apparent reason
120 if { [ llength $retcode ] > 5 } {
121 fail "${file} died prematurely ([lindex $retcode 6])"
124 # This snippet catches non-zero returns
125 if { [ lindex $retcode 3 ] != 0 } {
126 fail "${file} exited with non-zero code ([lindex $retcode 3])"
129 # force a close of the executable to be safe.