gcc/
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Nov 2008 18:51:07 +0000 (18:51 +0000)
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Nov 2008 18:51:07 +0000 (18:51 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142225 138bc75d-0d04-0410-961f-82ee72b054a4

19 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/lib/g++.exp
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/gcc.exp
gcc/testsuite/lib/gfortran.exp
gcc/testsuite/lib/gnat.exp
gcc/testsuite/lib/obj-c++.exp
gcc/testsuite/lib/objc.exp
gcc/testsuite/lib/timeout-dg.exp [new file with mode: 0644]
gcc/testsuite/lib/timeout.exp [new file with mode: 0644]
libgomp/ChangeLog
libgomp/testsuite/lib/libgomp.exp
libmudflap/ChangeLog
libmudflap/testsuite/lib/libmudflap.exp
libmudflap/testsuite/lib/mfdg.exp
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/lib/libstdc++.exp

index 8efb64a..ef13776 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-26  Janis Johnson  <janis187@us.ibm.com>
+
+       PR testsuite/28870
+       * doc/sourcebuild.texi (Test Directives): Add dg-timeout and
+       dg-timeout-factor.
+
 2008-11-26  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/sync.md (memory_barrier_nosse): Disable also for
index c7a5d4f..672f6d1 100644 (file)
@@ -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
index 46594c1..89264b2 100644 (file)
@@ -1,3 +1,18 @@
+2008-11-26  Janis Johnson  <janis187@us.ibm.com>
+
+       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  <hongjiu.lu@intel.com>
 
        PR middle-end/37843
index 07f1c50..09f6e26 100644 (file)
@@ -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]
 
index 5d1efbb..13e0171 100644 (file)
@@ -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
        }
index 5985ce0..070b966 100644 (file)
@@ -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]
index c00ee09..b0e66d8 100644 (file)
@@ -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]
index 2ff7997..af120b0 100644 (file)
@@ -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}"
index 37882cb..502f4a7 100644 (file)
@@ -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]
 
index 37e2a3f..a9c2853 100644 (file)
@@ -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 (file)
index 0000000..45de904
--- /dev/null
@@ -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
+# <http://www.gnu.org/licenses/>.
+
+#
+# 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 (file)
index 0000000..b4f4c18
--- /dev/null
@@ -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
+# <http://www.gnu.org/licenses/>.
+
+#
+# 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
+    }
+}
index ed7b7a1..0cdfba6 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-26  Janis Johnson  <janis187@us.ibm.com>
+
+       PR testsuite/28870
+       * testsuite/lib/libgomp.exp: Include new timeout library files.
+       (libgomp_target_compile): Set timeout value from new proc.
+
 2008-11-13  Steve Ellcey  <sje@cup.hp.com>
 
        PR libgomp/37938
index f86f1a1..4e2600e 100644 (file)
@@ -22,6 +22,8 @@ load_gcc_lib target-libpath.exp
 load_gcc_lib wrapper.exp
 load_gcc_lib gcc-defs.exp
 load_gcc_lib torture-options.exp
+load_gcc_lib timeout.exp
+load_gcc_lib timeout-dg.exp
 load_gcc_lib gcc-dg.exp
 load_gcc_lib gfortran-dg.exp
 
@@ -180,6 +182,7 @@ proc libgomp_target_compile { source dest type options } {
     }
 
     lappend options "additional_flags=[libio_include_flags]"
+    lappend options "timeout=[timeout_value]"
     lappend options "compiler=$GCC_UNDER_TEST"
 
     set options [concat $libgomp_compile_options $options]
index 208ab8f..c75648e 100644 (file)
@@ -1,3 +1,12 @@
+2008-11-26  Janis Johnson  <janis187@us.ibm.com>
+
+       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.
+
 2008-11-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/35314
index 94d060b..1abd783 100644 (file)
@@ -29,6 +29,8 @@ proc load_gcc_lib { filename } {
 load_lib mfdg.exp
 load_lib libgloss.exp
 load_gcc_lib target-libpath.exp
+load_gcc_lib timeout.exp
+load_gcc_lib timeout-dg.exp
 
 proc libmudflap-init { language } {
     global env
@@ -213,6 +215,7 @@ proc libmudflap_target_compile { source dest type options } {
     set cxx_final [concat $cxx_final $libs]
 
     lappend options "compiler=$cxx_final"
+    lappend options "timeout=[timeout_value]"
 
     # Picks up the freshly-built testsuite library corresponding to the
     # multilib under test.
index 7bcd44a..6870299 100644 (file)
@@ -40,8 +40,7 @@ proc dg-test { args } {
     set keep 0
     set i 0
     set dg-repetitions 1 ;# may be overridden by { dg-repetitions N }
-    global dg-timeout
-    set dg-timeout 0 ;# likewise by { dg-timeout N }
+    unset_timeout_vars
 
     if { [string index [lindex $args 0] 0] == "-" } {
        for { set i 0 } { $i < [llength $args] } { incr i } {
@@ -347,31 +346,3 @@ proc dg-repetitions { line value } {
     upvar dg-repetitions repetitions
     set repetitions $value
 }
-
-
-# 
-# Indicate that this test case is to be run with a short timeout.
-# The embedded format is "{ dg-timeout N }", where N is in seconds.
-#
-proc dg-timeout { line value } {
-    global dg-timeout
-    set dg-timeout $value
-}
-
-
-# dejagnu's config/unix.exp hard-codes 300 seconds as the timeout
-# for any natively run executable.  That's too long for tests run
-# multiple times and that may possibly hang.  So we override it here
-# to provide some degree of control.
-rename standard_wait hooked_standard_wait
-proc standard_wait { dest timeout } {
-    global dg-timeout
-    if {[info exists dg-timeout]} {
-       if {${dg-timeout} > 0} {
-           verbose -log "Overriding timeout = ${dg-timeout}"
-           set timeout ${dg-timeout}
-       }
-    }
-
-    hooked_standard_wait $dest $timeout
-}
index 2cd9609..a963802 100644 (file)
@@ -1,3 +1,12 @@
+2008-11-26  Janis Johnson  <janis187@us.ibm.com>
+
+       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.
+
 2008-11-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR libstdc++/38244 (cont, debug bits)
index 8a4e8c4..3b2e18b 100644 (file)
@@ -53,6 +53,8 @@ load_gcc_lib target-supports-dg.exp
 load_lib prune.exp
 load_lib dg-options.exp
 load_gcc_lib target-libpath.exp
+load_gcc_lib timeout.exp
+load_gcc_lib timeout-dg.exp
 load_gcc_lib wrapper.exp
 
 # Useful for debugging.  Pass the name of a variable and the verbosity
@@ -89,6 +91,7 @@ proc libstdc++_init { testfile } {
     global ld_library_path
     global target_triplet
     global flags_file
+    global tool_timeout
 
     # We set LC_ALL and LANG to C so that we get the same error
     # messages as expected.
@@ -184,6 +187,9 @@ proc libstdc++_init { testfile } {
        set compiler [transform "g++"]
     }
 
+    # Set the default timeout for v3 tests.
+    set tool_timeout 600
+
     # Default settings.
     set cxx [transform "g++"]
     set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0"
@@ -346,6 +352,24 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } {
     return [list $comp_output $output_file]
 }
 
+# Override the DejaGnu dg-test in order to clear flags after a test, as
+# is done for compiler tests in gcc-dg.exp.
+
+if { [info procs saved-dg-test] == [list] } {
+    rename dg-test saved-dg-test
+
+    proc dg-test { args } {
+       global errorInfo
+
+       if { [ catch { eval saved-dg-test $args } errmsg ] } {
+           set saved_info $errorInfo
+           unset_timeout_vars
+           error $errmsg $saved_info
+       }
+       unset_timeout_vars
+    }
+}
+
 # True if the library supports wchar_t.
 set v3-wchar_t 0
 
@@ -389,7 +413,7 @@ proc v3_target_compile { source dest type options } {
     }
 
     lappend options "compiler=$cxx_final"
-    lappend options "timeout=600"
+    lappend options "timeout=[timeout_value]"
 
     return [target_compile $source $dest $type $options]
 }
@@ -455,7 +479,7 @@ proc v3_target_compile_as_c { source dest type options } {
     set cc_final [concat $cc_final "$libdir"]
 
     lappend options "compiler=$cc_final"
-    lappend options "timeout=600"
+    lappend options "timeout=[timeout_value]"
 
     return [target_compile $source $dest $type $options]
 }