Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / testsuite / lib / checkoutput.exp
blob146f87b009c3185da6f70244986abce3fe5acfeb
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 subdir srcdir tmpdir
14 set srcfullname "$srcdir/$subdir/$srcfile"
15 set test_driver "$tmpdir/[file tail [file rootname $srcfullname].x]"
17 set comp_output [newlib_target_compile "$srcfullname" "$test_driver" "executable" ""]
19 if { $comp_output != "" } {
20 fail "$subdir/$srcfile compilation"
21 unresolved "$subdir/$srcfile output"
22 return
24 pass "$subdir/$srcfile compilation"
26 set result [newlib_load $test_driver ""]
27 set status [lindex $result 0]
28 set output [lindex $result 1]
30 set output_lines [split $output "\n"]
32 foreach { expectedval } $expectlist {
33 set gotval [string trim [lindex $output_lines 0] "\r"]
34 if { ! [string match $expectedval $gotval] } {
35 verbose -log "$subdir/$srcfile: Expected: $expectedval Got: $gotval "
36 fail "$subdir/$srcfile output"
37 return
39 set output_lines [lrange $output_lines 1 end]
42 pass "$subdir/$srcfile output"