2017-09-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / lib / timeout.exp
blob50c7b45aff8a1b706550d872368b04937067e8f1
1 # Copyright (C) 2008-2017 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
18 # unset_timeout_vars -- Unset variables used for timeouts
21 proc unset_timeout_vars { args } {
22 global individual_timeout
23 global timeout_factor
25 if [info exists individual_timeout] {
26 unset individual_timeout
28 if [info exists timeout_factor] {
29 unset timeout_factor
34 # timeout_value -- Return the integer timeout value to use for this test
37 proc timeout_value { args } {
38 global tool_timeout
39 global individual_timeout
40 global timeout_factor
42 # Find the current timeout limit, in seconds.
43 if [info exists individual_timeout] {
44 set val $individual_timeout
45 } elseif [info exists tool_timeout] {
46 set val $tool_timeout
47 } elseif [target_info exists gcc,timeout] {
48 set val [target_info gcc,timeout]
49 } elseif [board_info target exists gcc,timeout] {
50 set val [board_info target gcc,timeout]
51 } else {
52 # This is really, REALLY ugly, but this is the default from
53 # remote.exp deep within DejaGnu.
54 set val 300
57 # If the test specified a timeout factor, adjust by that.
58 if [info exists timeout_factor] {
59 set val [expr int([expr $val * $timeout_factor])]
62 return $val
66 # standard_wait -- Set the timeout value used by DejaGnu
69 # Override standard_wait from DejaGnu to use timeout value specified by
70 # by the user or by the target board, possibly multiplied by a factor
71 # for a particular test.
73 if { [info procs standard_wait] != [list] \
74 && [info procs saved_standard_wait] == [list] } {
75 rename standard_wait saved_standard_wait
76 proc standard_wait { dest timeout } {
77 set val [timeout_value]
78 if { $val != 0 } {
79 set timeout $val
81 saved_standard_wait $dest $timeout