fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / testsuite / lib / checkoutput.exp
blob8cb46925f9932cf85630e85a2e4fd53ae3ed77dc
1 # Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 # Permission to use, copy, modify, and distribute this software
4 # is freely granted, provided that this notice is preserved.
7 # newlib_check_output takes the basename of the test source file, and
8 # a list of TCL regular expressions representing the expected output.
9 # It assumes one line of output per test.
11 proc newlib_check_output { srcfile expectlist } {
12 global objdir subdir srcdir
14 set srcfullname "$srcdir/$subdir/$srcfile"
15 set test_driver "$objdir/testsuite/[file tail [file rootname $srcfullname].x]"
17 set comp_output [newlib_target_compile "$srcfullname" "$test_driver" "executable" ""]
19 if { $comp_output != "" } {
20 fail "Failed to compile $srcfile.\n"
21 return
24 set result [newlib_load $test_driver ""]
25 set status [lindex $result 0]
26 set output [lindex $result 1]
28 set output_lines [split $output "\n"]
30 foreach { expectedval } $expectlist {
31 set gotval [string trim [lindex $output_lines 0] "\r"]
32 if { ! [string match $expectedval $gotval] } {
33 fail "$srcfile: Expected: $expectedval Got: $gotval "
34 return
36 set output_lines [lrange $output_lines 1 end]
39 pass $srcfile