4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-15 19:09:58 +08:00
newlib-cygwin/newlib/testsuite/lib/checkoutput.exp
Thomas Fitzsimmons 3495f076f3 * testsuite/lib/checkoutput.exp (newlib_check_output): Output
only one pass or fail per test file.  Trim \r's from output
	values received from test programs.  Remove support for named
	tests.
	* testsuite/newlib.locale/UTF-8.exp: Update to support new
	newlib_check_output behaviour.
	* testsuite/newlib.locale/UTF-8.c: Likewise.
2002-05-15 23:48:47 +00:00

41 lines
1.2 KiB
Plaintext

# 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
# a list of TCL regular expressions representing the expected output.
# It assumes one line of output per test.
proc newlib_check_output { srcfile expectlist } {
global objdir subdir srcdir
set srcfullname "$srcdir/$subdir/$srcfile"
set test_driver "$objdir/testsuite/[file tail [file rootname $srcfullname].x]"
set comp_output [newlib_target_compile "$srcfullname" "$test_driver" "executable" ""]
if { $comp_output != "" } {
fail "Failed to compile $srcfile.\n"
return
}
set result [newlib_load $test_driver ""]
set status [lindex $result 0]
set output [lindex $result 1]
set output_lines [split $output "\n"]
foreach { expectedval } $expectlist {
set gotval [string trim [lindex $output_lines 0] "\r"]
if { ! [string match $expectedval $gotval] } {
fail "$srcfile: Expected: $expectedval Got: $gotval "
return
}
set output_lines [lrange $output_lines 1 end]
}
pass $srcfile
}