2002-04-25 04:53:30 +08:00
|
|
|
# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software
|
|
|
|
# is freely granted, provided that this notice is preserved.
|
|
|
|
#
|
|
|
|
|
|
|
|
# newlib_check_output takes the basename of the test source file, and
|
2002-05-16 07:48:47 +08:00
|
|
|
# a list of TCL regular expressions representing the expected output.
|
|
|
|
# It assumes one line of output per test.
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
proc newlib_check_output { srcfile expectlist } {
|
2005-07-05 08:11:50 +08:00
|
|
|
global subdir srcdir tmpdir
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
set srcfullname "$srcdir/$subdir/$srcfile"
|
2005-07-05 08:11:50 +08:00
|
|
|
set test_driver "$tmpdir/[file tail [file rootname $srcfullname].x]"
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
set comp_output [newlib_target_compile "$srcfullname" "$test_driver" "executable" ""]
|
|
|
|
|
|
|
|
if { $comp_output != "" } {
|
2005-07-19 03:07:49 +08:00
|
|
|
fail "$subdir/$srcfile compilation"
|
|
|
|
unresolved "$subdir/$srcfile output"
|
2002-05-16 07:48:47 +08:00
|
|
|
return
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|
2005-07-19 03:07:49 +08:00
|
|
|
pass "$subdir/$srcfile compilation"
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
set result [newlib_load $test_driver ""]
|
|
|
|
set status [lindex $result 0]
|
|
|
|
set output [lindex $result 1]
|
|
|
|
|
|
|
|
set output_lines [split $output "\n"]
|
|
|
|
|
2002-05-16 07:48:47 +08:00
|
|
|
foreach { expectedval } $expectlist {
|
|
|
|
set gotval [string trim [lindex $output_lines 0] "\r"]
|
|
|
|
if { ! [string match $expectedval $gotval] } {
|
2005-07-19 03:07:49 +08:00
|
|
|
verbose -log "$subdir/$srcfile: Expected: $expectedval Got: $gotval "
|
|
|
|
fail "$subdir/$srcfile output"
|
2002-05-16 07:48:47 +08:00
|
|
|
return
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|
|
|
|
set output_lines [lrange $output_lines 1 end]
|
|
|
|
}
|
2002-05-16 07:48:47 +08:00
|
|
|
|
2005-07-19 03:07:49 +08:00
|
|
|
pass "$subdir/$srcfile output"
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|