From d4038ca243dc612e06deeec2cb9dfd4e89a01962 Mon Sep 17 00:00:00 2001 From: Janis Johnson Date: Wed, 26 Nov 2008 18:51:07 +0000 Subject: re PR testsuite/28870 (configuring, over-riding timeout values in testsuite) gcc/ PR testsuite/28870 * doc/sourcebuild.texi (Test Directives): Add dg-timeout and dg-timeout-factor. gcc/testsuite/ PR testsuite/28870 * lib/timeout.exp: New. * lib/timeout-dg.exp: New. * lib/gcc-dg.exp: Include new timeout library files. (dg-test): Unset timeout variables. * lib/gcc.exp (gcc_target_compile): Set timeout value from new proc. * lib/g++.exp (g++_target_compile): Ditto. * lib/gfortran.exp (gfortran_target_compile): Ditto. * lib/objc.exp (objc_target_compile): Ditto. * lib/obj-c++.exp (obj-c++_target_compile): Ditto. * lib/obj-c++.exp (obj-c++_target_compile): Ditto. * lib/gnat.exp (gnat_target_compile): Ditto. libstdc++-v3/ PR testsuite/28870 * testsuite/lib/libstdc++.exp: Include new timeout library files. (libstdc++_init): Define tool_timeout. (dg-test): Override DejaGnu proc. (v3_target_compile): Set timeout value from new proc. (v3_target_compile_as_c): Ditto. libmudflap/ PR testsuite/28870 * testsuite/lib/mfdg.exp (dg-test): Use new timeout support. (dg-timeout): Remove. (standard-wait): Remove. * testsuite/lib/libmudflap.exp: Include new timeout library files. (libmudflap_target_compile): Set timeout value from new proc. libgomp/ PR testsuite/28870 * testsuite/lib/libgomp.exp: Include new timeout library files. (libgomp_target_compile): Set timeout value from new proc. From-SVN: r142225 --- gcc/ChangeLog | 6 +++ gcc/doc/sourcebuild.texi | 20 ++++++++++ gcc/testsuite/ChangeLog | 15 ++++++++ gcc/testsuite/lib/g++.exp | 2 + gcc/testsuite/lib/gcc-dg.exp | 4 ++ gcc/testsuite/lib/gcc.exp | 5 +-- gcc/testsuite/lib/gfortran.exp | 2 + gcc/testsuite/lib/gnat.exp | 2 + gcc/testsuite/lib/obj-c++.exp | 2 + gcc/testsuite/lib/objc.exp | 2 + gcc/testsuite/lib/timeout-dg.exp | 49 ++++++++++++++++++++++++ gcc/testsuite/lib/timeout.exp | 81 ++++++++++++++++++++++++++++++++++++++++ 12 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/lib/timeout-dg.exp create mode 100644 gcc/testsuite/lib/timeout.exp (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8efb64a..ef13776 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-11-26 Janis Johnson + + PR testsuite/28870 + * doc/sourcebuild.texi (Test Directives): Add dg-timeout and + dg-timeout-factor. + 2008-11-26 Uros Bizjak * config/i386/sync.md (memory_barrier_nosse): Disable also for diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index c7a5d4f..672f6d1 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -990,6 +990,26 @@ The target's C99 runtime (both headers and libraries). and only then in certain modes. @end table +@item @{ dg-timeout @var{n} [@{target @var{selector} @}] @} +Set the time limit for the compilation and for the execution of the test +to the specified number of seconds. + +@item @{ dg-timeout-factor @var{x} [@{ target @var{selector} @}] @} +Multiply the normal time limit for compilation and execution of the test +by the specified floating-point factor. The normal timeout limit, in +seconds, is found by searching the following in order: + +@itemize @bullet +@item the value defined by an earlier @code{dg-timeout} directive in +the test + +@item variable @var{tool_timeout} defined by the set of tests + +@item @var{gcc,,timeout} set in the target board + +@item 300 +@end itemize + @item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} Skip the test if the test system is included in @var{selector} and if each of the options in @var{include-opts} is in the set of options with diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46594c1..89264b2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2008-11-26 Janis Johnson + + PR testsuite/28870 + * lib/timeout.exp: New. + * lib/timeout-dg.exp: New. + * lib/gcc-dg.exp: Include new timeout library files. + (dg-test): Unset timeout variables. + * lib/gcc.exp (gcc_target_compile): Set timeout value from new proc. + * lib/g++.exp (g++_target_compile): Ditto. + * lib/gfortran.exp (gfortran_target_compile): Ditto. + * lib/objc.exp (objc_target_compile): Ditto. + * lib/obj-c++.exp (obj-c++_target_compile): Ditto. + * lib/obj-c++.exp (obj-c++_target_compile): Ditto. + * lib/gnat.exp (gnat_target_compile): Ditto. + 2008-11-26 H.J. Lu PR middle-end/37843 diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 07f1c50..09f6e26 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -24,6 +24,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -279,6 +280,7 @@ proc g++_target_compile { source dest type options } { lappend options "additional_flags=[libio_include_flags]" lappend options "compiler=$GXX_UNDER_TEST" + lappend options "timeout=[timeout_value]" set options [concat $gpp_compile_options $options] diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 5d1efbb..13e0171 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -23,6 +23,8 @@ load_lib scanasm.exp load_lib scanrtl.exp load_lib scantree.exp load_lib scanipa.exp +load_lib timeout.exp +load_lib timeout-dg.exp load_lib prune.exp load_lib libgloss.exp load_lib target-libpath.exp @@ -580,12 +582,14 @@ if { [info procs saved-dg-test] == [list] } { if [info exists compiler_conditional_xfail_data] { unset compiler_conditional_xfail_data } + unset_timeout_vars error $errmsg $saved_info } set additional_files "" set additional_sources "" set additional_prunes "" set shouldfail 0 + unset_timeout_vars if [info exists compiler_conditional_xfail_data] { unset compiler_conditional_xfail_data } diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index 5985ce0..070b966 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -29,6 +29,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp # # GCC_UNDER_TEST is the compiler under test. @@ -147,9 +148,7 @@ proc gcc_target_compile { source dest type options } { if [info exists TOOL_OPTIONS] { set options [concat "{additional_flags=$TOOL_OPTIONS}" $options] } - if [target_info exists gcc,timeout] { - lappend options "timeout=[target_info gcc,timeout]" - } + lappend options "timeout=[timeout_value]" lappend options "compiler=$GCC_UNDER_TEST" set options [dg-additional-files-options $options $source] return [target_compile $source $dest $type $options] diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp index c00ee09..b0e66d8 100644 --- a/gcc/testsuite/lib/gfortran.exp +++ b/gcc/testsuite/lib/gfortran.exp @@ -24,6 +24,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -193,6 +194,7 @@ proc gfortran_target_compile { source dest type options } { } lappend options "compiler=$GFORTRAN_UNDER_TEST" + lappend options "timeout=[timeout_value]" set options [concat "$ALWAYS_GFORTRANFLAGS" $options] set options [dg-additional-files-options $options $source] diff --git a/gcc/testsuite/lib/gnat.exp b/gcc/testsuite/lib/gnat.exp index 2ff7997..af120b0 100644 --- a/gcc/testsuite/lib/gnat.exp +++ b/gcc/testsuite/lib/gnat.exp @@ -27,6 +27,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp # # GNAT_UNDER_TEST is the compiler under test. @@ -131,6 +132,7 @@ proc gnat_target_compile { source dest type options } { set ld_library_path ".:${gnat_libgcc_s_path}" lappend options "compiler=$GNAT_UNDER_TEST -q -f" lappend options "incdir=${rootme}/ada/rts" + lappend options "timeout=[timeout_value] if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { lappend options "libs=${gluefile}" diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp index 37882cb..502f4a7 100644 --- a/gcc/testsuite/lib/obj-c++.exp +++ b/gcc/testsuite/lib/obj-c++.exp @@ -23,6 +23,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -324,6 +325,7 @@ proc obj-c++_target_compile { source dest type options } { lappend options "additional_flags=[libio_include_flags]" lappend options "compiler=$OBJCXX_UNDER_TEST"; + lappend options "timeout=[timeout_value]" set options [concat $gpp_compile_options $options] diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index 37e2a3f..a9c2853 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -28,6 +28,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -193,6 +194,7 @@ proc objc_target_compile { source dest type options } { set source [concat "-x objective-c-header" $source] } lappend options "compiler=$OBJC_UNDER_TEST" + lappend options "timeout=[timeout_value] set_ld_library_path_env_vars diff --git a/gcc/testsuite/lib/timeout-dg.exp b/gcc/testsuite/lib/timeout-dg.exp new file mode 100644 index 0000000..45de904 --- /dev/null +++ b/gcc/testsuite/lib/timeout-dg.exp @@ -0,0 +1,49 @@ +# Copyright (C) 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 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 GCC; see the file COPYING3. If not see +# . + +# +# dg-timeout -- Set the timout limit, in seconds, for a particular test +# + +proc dg-timeout { args } { + global individual_timeout + + set args [lreplace $args 0 0] + if { [llength $args] > 1 } { + if { [dg-process-target [lindex $args 1]] == "S" } { + set individual_timeout [lindex $args 0] + } + } else { + set individual_timeout [lindex $args 0] + } +} + +# +# dg-timeout-factor -- Scale the timeout limit for a particular test +# + +proc dg-timeout-factor { args } { + global timeout_factor + + set args [lreplace $args 0 0] + if { [llength $args] > 1 } { + if { [dg-process-target [lindex $args 1]] == "S" } { + set timeout_factor [lindex $args 0] + } + } else { + set timeout_factor [lindex $args 0] + } +} diff --git a/gcc/testsuite/lib/timeout.exp b/gcc/testsuite/lib/timeout.exp new file mode 100644 index 0000000..b4f4c18 --- /dev/null +++ b/gcc/testsuite/lib/timeout.exp @@ -0,0 +1,81 @@ +# Copyright (C) 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 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 GCC; see the file COPYING3. If not see +# . + +# +# unset_timeout_vars -- Unset variables used for timeouts +# + +proc unset_timeout_vars { args } { + global individual_timeout + global timeout_factor + + if [info exists individual_timeout] { + unset individual_timeout + } + if [info exists timeout_factor] { + unset timeout_factor + } +} + +# +# timeout_value -- Return the integer timeout value to use for this test +# + +proc timeout_value { args } { + global tool_timeout + global individual_timeout + global timeout_factor + + # Find the current timeout limit, in seconds. + if [info exists individual_timeout] { + set val $individual_timeout + } elseif [info exists tool_timeout] { + set val $tool_timeout + } elseif [target_info exists gcc,timeout] { + set val [target_info gcc,timeout] + } else { + # This is really, REALLY ugly, but this is the default from + # remote.exp deep within DejaGnu. + set val 300 + } + + # If the test specified a timeout factor, adjust by that. + if [info exists timeout_factor] { + set val [expr int([expr $val * $timeout_factor])] + } + + return $val +} + +# +# standard_wait -- Set the timeout value used by DejaGnu +# + +# Override standard_wait from DejaGnu to use timeout value specified by +# by the user or by the target board, possibly multiplied by a factor +# for a particular test. + +if { [info procs standard_wait] != [list] \ + && [info procs saved_standard_wait] == [list] } { + rename standard_wait saved_standard_wait + proc standard_wait { dest timeout } { + set val [timeout_value] + if { $val != 0 } { + set timeout $val + } + saved_standard_wait $dest $timeout + } +} -- cgit v1.1