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 with a failure.
12 # This is to handle deadlocks. We don
't reset the timeout when a match is
13 # found to avoid hanging in case of a testcase sending matches in an infinite loops.
14 # (not unlikely as it seems, think about flash movies...)
16 # Expressed in seconds.
23 set env(LANG) en_US.UTF-8
24 set env(LANGUAGE) en_US.UTF-8
25 set env(LC_ALL) en_US.UTF-8
27 # testcases is set by the Makefile in the site.exp data file.
28 foreach file $testcases {
30 verbose "Running test $file"
32 # spawn the executable and look for the DejaGnu output messages from the
35 # this version of the call allows use of 'wait
' to check return code
36 # -open [open "|cmd" "r"] doesn't work
for that
38 # Ignore SIGHUP or we
'd get a lot of them on Debian stable
39 spawn -noecho -ignore SIGHUP ./$file
42 -re "^\[^\n]*NOTE:\[^\n]*\n" {
43 regsub ".*NOTE: " $expect_out(0,string) "" output
44 set output [string range $output 0 end-2]
45 verbose "${file} $output"
46 # notes tipically come from the test runner, so we'll trust it to mean
47 # things are someone not too bad...
51 -re
"^\[^\n]*XPASSED:\[^\n]*\n" {
52 regsub
".*XPASSED: " $expect_out(0,string) "" output
53 set output
[string range $output
0 end
-2]
54 xpass
"${file}: $output"
55 exp_continue
-continue_timer
57 -re
"^\[^\n]*PASSED:\[^\n]*\n" {
58 regsub
".*PASSED: " $expect_out(0,string) "" output
59 set output
[string range $output
0 end
-2]
60 pass
"${file}: $output"
61 exp_continue
-continue_timer
63 -re
"^\[^\n]*XFAILED:\[^\n]*\n" {
64 regsub
".*XFAILED: " $expect_out(0,string) "" output
65 set output
[string range $output
0 end
-2]
66 xfail
"${file}: $output"
67 exp_continue
-continue_timer
69 -re
"^\[^\n]*FAILED:\[^\n]*\n" {
70 regsub
".*FAILED: " $expect_out(0,string) "" output
71 set output
[string range $output
0 end
-2]
72 fail
"${file}: $output"
73 exp_continue
-continue_timer
75 -re
"^\[^\n]*UNTESTED:\[^\n]*\n" {
76 regsub
".*UNTESTED: " $expect_out(0,string) "" output
77 set output
[string range $output
0 end
-2]
78 untested
"${file}: $output"
79 exp_continue
-continue_timer
81 -re
"^\[^\n]*UNRESOLVED:\[^\n]*\n" {
82 regsub
".*UNRESOLVED: " $expect_out(0,string) "" output
83 set output
[string range $output
0 end
-2]
84 unresolved
"${file}: $output"
85 exp_continue
-continue_timer
88 # just remove non
-matching lines
!
89 exp_continue
-continue_timer
92 # unresolved
"${file} died prematurely"
94 #
return "${file} died prematurely"
97 fail
"Test case ${file} still running after ${timeout} seconds, killing it (deadlock?)"
103 # wait
for the process to coplete to
108 #
set i
0; foreach j $retcode
{ print
"${file} wait($i) $j"; incr i }
110 # This snippet catches segfaults and aborts.
111 # Would also catch SIGHUP
, but we
're ignoring them
112 # as on Debian Stable we unexpectedly get them for no apparent reason
114 if { [ llength $retcode ] > 5 } {
115 fail "${file} died prematurely ([lindex $retcode 6])"
118 # This snippet catches non-zero returns
119 if { [ lindex $retcode 3 ] != 0 } {
120 fail "${file} exited with non-zero code ([lindex $retcode 3])"
125 # force a close of the executable to be safe.