timeout.exp 2.3 KB

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