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_pass_fail_all compiles and runs all the source files in the |
---|
8 | # test directory. If flag is -x, then the sources whose basenames are |
---|
9 | # listed in exclude_list are not compiled and run. |
---|
10 | |
---|
11 | proc newlib_pass_fail_all { flag exclude_list } { |
---|
12 | global srcdir objdir subdir runtests |
---|
13 | |
---|
14 | foreach fullsrcfile [glob -nocomplain $srcdir/$subdir/*.c] { |
---|
15 | set srcfile "[file tail $fullsrcfile]" |
---|
16 | # If we're only testing specific files and this isn't one of them, skip it. |
---|
17 | if ![runtest_file_p $runtests $srcfile] then { |
---|
18 | continue |
---|
19 | } |
---|
20 | |
---|
21 | # Exclude tests listed in exclude_list. |
---|
22 | if { $flag == "-x" } then { |
---|
23 | if {[lsearch $exclude_list "$srcfile"] != -1} then { |
---|
24 | continue |
---|
25 | } |
---|
26 | } |
---|
27 | newlib_pass_fail "$srcfile" |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | # newlib_pass_fail takes the basename of a test source file, which it |
---|
32 | # compiles and runs. |
---|
33 | |
---|
34 | proc newlib_pass_fail { srcfile } { |
---|
35 | global srcdir tmpdir subdir |
---|
36 | |
---|
37 | set fullsrcfile "$srcdir/$subdir/$srcfile" |
---|
38 | |
---|
39 | set test_driver "$tmpdir/[file rootname $srcfile].x" |
---|
40 | |
---|
41 | set comp_output [newlib_target_compile "$fullsrcfile" "$test_driver" "executable" ""] |
---|
42 | |
---|
43 | if { $comp_output != "" } { |
---|
44 | fail "$subdir/$srcfile compilation" |
---|
45 | unresolved "$subdir/$srcfile execution" |
---|
46 | } else { |
---|
47 | pass "$subdir/$srcfile compilation" |
---|
48 | set result [newlib_load $test_driver ""] |
---|
49 | set status [lindex $result 0] |
---|
50 | $status "$subdir/$srcfile execution" |
---|
51 | } |
---|
52 | } |
---|