source: trunk/libs/newlib/src/newlib/testsuite/lib/checkoutput.exp @ 620

Last change on this file since 620 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.3 KB
Line 
1# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
2#
3# Permission to use, copy, modify, and distribute this software
4# is freely granted, provided that this notice is preserved.
5#
6
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.
10
11proc newlib_check_output { srcfile expectlist } {
12    global subdir srcdir tmpdir
13
14    set srcfullname "$srcdir/$subdir/$srcfile"
15    set test_driver "$tmpdir/[file tail [file rootname $srcfullname].x]"
16
17    set comp_output [newlib_target_compile "$srcfullname" "$test_driver" "executable" ""]
18
19    if { $comp_output != "" } {
20        fail "$subdir/$srcfile compilation"
21        unresolved "$subdir/$srcfile output"
22        return
23    }
24    pass "$subdir/$srcfile compilation"
25
26    set result [newlib_load $test_driver ""]
27    set status [lindex $result 0]
28    set output [lindex $result 1]
29
30    set output_lines [split $output "\n"]
31
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
38        }
39        set output_lines [lrange $output_lines 1 end]
40    }
41
42    pass "$subdir/$srcfile output"
43}
Note: See TracBrowser for help on using the repository browser.