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