]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/lib/timeout.exp
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / lib / timeout.exp
1 # Copyright (C) 2008-2021 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
16
17 #
18 # unset_timeout_vars -- Unset variables used for timeouts
19 #
20
21 proc unset_timeout_vars { args } {
22 global individual_timeout
23 global timeout_factor
24
25 if [info exists individual_timeout] {
26 unset individual_timeout
27 }
28 if [info exists timeout_factor] {
29 unset timeout_factor
30 }
31 }
32
33 #
34 # timeout_value -- Return the integer timeout value to use for this test
35 #
36
37 proc timeout_value { args } {
38 global tool_timeout
39 global individual_timeout
40 global timeout_factor
41
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
55 }
56
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])]
60 }
61
62 return $val
63 }
64
65 #
66 # standard_wait -- Set the timeout value used by DejaGnu
67 #
68
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.
72
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
80 }
81 saved_standard_wait $dest $timeout
82 }
83 }