diff options
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r-- | gcc/testsuite/lib/gcc-dg.exp | 23 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 49 |
2 files changed, 56 insertions, 16 deletions
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index c5f589e..d1a85a8 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -4,15 +4,15 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. load_lib dg.exp load_lib file-format.exp @@ -175,7 +175,7 @@ proc gcc-dg-runtest { testcases default-extra-flags } { global runtests foreach test $testcases { - # If we're only testing specific files and this isn't one of + # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { continue @@ -226,7 +226,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { global runtests foreach test $testcases { - # If we're only testing specific files and this isn't one of + # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { continue @@ -237,7 +237,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { foreach flags $DEBUG_TORTURE_OPTIONS { set doit 1 if { [string match {*/debug-[126].c} "$nshort"] \ - && [string match "*1" [lindex "$flags" 0] ] } { + && [string match "*1" [lindex "$flags" 0] ] } { set doit 0 } @@ -333,7 +333,7 @@ proc dg-require-profiling { args } { # If this target does not support DLL attributes skip this test. -proc dg-require-dll { args } { +proc dg-require-dll { args } { global target_triplet # As a special case, the mcore-*-elf supports dllimport/dllexport. if { [string match "mcore-*-elf" $target_triplet] } { @@ -348,6 +348,15 @@ proc dg-require-dll { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } +proc dg-require-iconv { args } { + if { ![ check_iconv_available ${args} ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} + # Prune any messages matching ARGS[1] (a regexp) from test output. proc dg-prune-output { args } { global additional_prunes diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 485a8d7..ef29890 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4,15 +4,15 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # gcc-patches@gcc.gnu.org @@ -31,13 +31,13 @@ proc check_weak_available { } { global target_cpu # All mips targets should support it - + if { [ string first "mips" $target_cpu ] >= 0 } { return 1 } # All solaris2 targets should support it - + if { [regexp ".*-solaris2.*" $target_triplet] } { return 1 } @@ -139,7 +139,7 @@ proc check_alias_available { } { } } } - + verbose "check_alias_available returning $alias_available_saved" 2 } @@ -187,7 +187,7 @@ proc check_profiling_available { test_what } { # exist on any irix6 system currently posting testsuite results. # Support for -pg on irix relies on gcrt1.o which doesn't exist yet. # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html - if { [istarget mips*-*-irix*] + if { [istarget mips*-*-irix*] && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } { return 0 } @@ -201,13 +201,44 @@ proc check_profiling_available { test_what } { || [istarget strongarm*-*-elf] || [istarget xscale*-*-elf] || [istarget cris-*-*] - || [istarget h8300-*-*] + || [istarget h8300-*-*] || [istarget *-*-windiss] } { set profiling_available_saved 0 } else { set profiling_available_saved 1 } } - + return $profiling_available_saved } + +# Return true if iconv is supported on the target. In particular IBM-1047. + +proc check_iconv_available { test_what } { + global tool + + set result "" + + verbose "check_iconv_available compiling testfile" 1 + set f [open "tmp.c" "w"] + # Compile a small test program. + puts $f "#include <iconv.h>\n" + puts $f "int main (void)\n {\n iconv_t cd; \n" + puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n" + puts $f "if (cd == (iconv_t) -1)\n return 1;\n" + puts $f "return 0;\n}" + close $f + + set lines [${tool}_target_compile "tmp.c" "tmp.x" executable ""] + + set result [${tool}_load "./tmp.x" "" ""] + set status [lindex $result 0]; + + verbose "status is <$status>" + + if { $status == "pass" } then { + return 1 + } + + return 0 +} |