2002-04-25 04:53:30 +08:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2002-06-19 06:39:17 +08:00
|
|
|
# newlib_pass_fail_all compiles and runs all the source files in the
|
|
|
|
# test directory. If flag is -x, then the sources whose basenames are
|
|
|
|
# listed in exclude_list are not compiled and run.
|
2002-04-25 04:53:30 +08:00
|
|
|
|
2002-06-19 06:39:17 +08:00
|
|
|
proc newlib_pass_fail_all { flag exclude_list } {
|
2002-04-25 04:53:30 +08:00
|
|
|
global srcdir objdir subdir runtests
|
|
|
|
|
2002-06-19 06:39:17 +08:00
|
|
|
foreach fullsrcfile [glob -nocomplain $srcdir/$subdir/*.c] {
|
|
|
|
set srcfile "[file tail $fullsrcfile]"
|
2002-04-25 04:53:30 +08:00
|
|
|
# If we're only testing specific files and this isn't one of them, skip it.
|
2002-06-19 06:39:17 +08:00
|
|
|
if ![runtest_file_p $runtests $srcfile] then {
|
2002-04-25 04:53:30 +08:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2002-06-19 06:39:17 +08:00
|
|
|
# Exclude tests listed in exclude_list.
|
|
|
|
if { $flag == "-x" } then {
|
|
|
|
if {[lsearch $exclude_list "$srcfile"] != -1} then {
|
|
|
|
continue
|
|
|
|
}
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|
2002-06-19 06:39:17 +08:00
|
|
|
newlib_pass_fail "$srcfile"
|
|
|
|
}
|
|
|
|
}
|
2002-04-25 04:53:30 +08:00
|
|
|
|
2002-06-19 06:39:17 +08:00
|
|
|
# newlib_pass_fail takes the basename of a test source file, which it
|
|
|
|
# compiles and runs.
|
|
|
|
|
|
|
|
proc newlib_pass_fail { srcfile } {
|
2005-07-05 08:11:50 +08:00
|
|
|
global srcdir tmpdir subdir
|
2002-06-19 06:39:17 +08:00
|
|
|
|
|
|
|
set fullsrcfile "$srcdir/$subdir/$srcfile"
|
|
|
|
|
2005-07-05 08:11:50 +08:00
|
|
|
set test_driver "$tmpdir/[file rootname $srcfile].x"
|
2002-06-19 06:39:17 +08:00
|
|
|
|
|
|
|
set comp_output [newlib_target_compile "$fullsrcfile" "$test_driver" "executable" ""]
|
|
|
|
|
|
|
|
if { $comp_output != "" } {
|
2005-07-19 03:07:49 +08:00
|
|
|
fail "$subdir/$srcfile compilation"
|
|
|
|
unresolved "$subdir/$srcfile execution"
|
2002-06-19 06:39:17 +08:00
|
|
|
} else {
|
2005-07-19 03:07:49 +08:00
|
|
|
pass "$subdir/$srcfile compilation"
|
2002-06-19 06:39:17 +08:00
|
|
|
set result [newlib_load $test_driver ""]
|
|
|
|
set status [lindex $result 0]
|
2005-07-19 03:07:49 +08:00
|
|
|
$status "$subdir/$srcfile execution"
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|
|
|
|
}
|