]> icculus.org git repositories - duncan/yast2-qt4.git/blob - testsuite/lib/y2qt_init.exp
restart qt4 porting
[duncan/yast2-qt4.git] / testsuite / lib / y2qt_init.exp
1 #
2 # run a ui file with y2qt
3 #
4 proc y2qt-run { src } {
5
6   set path [split $src "/"]
7   set filename [lindex $path [expr [llength $path]-1]]
8
9   # extract basename and check extension
10
11   set fname [split $filename "."]
12
13   if {[llength $fname] < 2} {
14     fail "Bad filename syntax '$src'"
15     return
16   }
17   if {[lindex $fname [expr [llength $fname]-1]] != "ui"} {
18     fail "Not .ui extension '$src'"
19     return
20   }
21
22   # setup filenames
23
24   set base_name [lindex $fname 0]
25
26   set stdout_name "tests/$base_name.out"
27   set tmpout_name    "tmp.out.$base_name"
28   set tmperr_name    "tmp.err.$base_name"
29
30   # due to a change of _debug() the stderr will be redirected to a log
31   # set stderr_name "tests/$base_name.err"
32
33   # run the test for qt
34
35   set result [exec "runqt" "$src" "-l" "$tmperr_name" ">" "$tmpout_name"]
36
37   # check return code
38
39   if {$result != ""} {
40     warning "Compilation of $base_name results in '$result'"
41   }
42
43   # check stdout
44
45   if {[diff $stdout_name $tmpout_name] != 1} {
46     fail "Wrong stdout for $base_name"
47   }
48
49   # check stderr  -- no longer needed ?!
50
51   # ok, all is fine
52
53   pass $base_name
54 }