Add findDisplayItemByTarget in MovieTester
[gnash.git] / testsuite / simple.exp
blob5172c22c272665cbf08c32aaf580fadc1e1585b2
2 load_lib "dejagnu.exp"
5 # If tracing has been enabled at the top level, then turn it on here
6 # too.
7 if $tracelevel {
8 strace $tracelevel
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.
18 set timeout 600
19 set file all
20 set params ""
22 global env
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
33 # test case.
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 set PID [spawn -noecho -ignore SIGHUP ./$file]
41 expect {
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...
48 # -continue_timer
49 exp_continue
51 -re "^\[^\n]* ERROR:\[^\n]*\n" {
52 regsub ".* ERROR: " $expect_out(0,string) "" output
53 set output [string range $output 0 end-2]
54 verbose "ERROR: ${file}: $output"
55 exp_continue -continue_timer
57 -re "^\[^\n]*XPASSED:\[^\n]*\n" {
58 regsub ".*XPASSED: " $expect_out(0,string) "" output
59 set output [string range $output 0 end-2]
60 xpass "${file}: $output"
61 exp_continue -continue_timer
63 -re "^\[^\n]*PASSED:\[^\n]*\n" {
64 regsub ".*PASSED: " $expect_out(0,string) "" output
65 set output [string range $output 0 end-2]
66 pass "${file}: $output"
67 exp_continue -continue_timer
69 -re "^\[^\n]*XFAILED:\[^\n]*\n" {
70 regsub ".*XFAILED: " $expect_out(0,string) "" output
71 set output [string range $output 0 end-2]
72 xfail "${file}: $output"
73 exp_continue -continue_timer
75 -re "^\[^\n]*FAILED:\[^\n]*\n" {
76 regsub ".*FAILED: " $expect_out(0,string) "" output
77 set output [string range $output 0 end-2]
78 fail "${file}: $output"
79 exp_continue -continue_timer
81 -re "^\[^\n]*UNTESTED:\[^\n]*\n" {
82 regsub ".*UNTESTED: " $expect_out(0,string) "" output
83 set output [string range $output 0 end-2]
84 untested "${file}: $output"
85 exp_continue -continue_timer
87 -re "^\[^\n]*UNRESOLVED:\[^\n]*\n" {
88 regsub ".*UNRESOLVED: " $expect_out(0,string) "" output
89 set output [string range $output 0 end-2]
90 unresolved "${file}: $output"
91 exp_continue -continue_timer
93 -re "^\[^\n]*\n" {
94 # just remove non-matching lines!
95 exp_continue -continue_timer
97 eof {
98 # unresolved "${file} died prematurely"
99 # catch close
100 # return "${file} died prematurely"
102 timeout {
103 fail "Test case ${file} still running after ${timeout} seconds, killing it (deadlock?)"
104 exec kill -9 $PID
105 catch close
106 continue;
110 # wait for the process to coplete to
111 # check return code
112 set retcode [wait]
114 # debugging
115 #set i 0; foreach j $retcode { print "${file} wait($i) $j"; incr i }
117 # This snippet catches segfaults and aborts.
118 # Would also catch SIGHUP, but we're ignoring them
119 # as on Debian Stable we unexpectedly get them for no apparent reason
121 if { [ llength $retcode ] > 5 } {
122 fail "${file} died prematurely ([lindex $retcode 6])"
125 # This snippet catches non-zero returns
126 if { [ lindex $retcode 3 ] != 0 } {
127 fail "${file} exited with non-zero code ([lindex $retcode 3])"
132 # force a close of the executable to be safe.
133 catch close