Skip to content
Browse files

Add --timeout for controlling runner timeout.

[git-p4: depot-paths = "//src/tinderbox/dev/": change = 2825]
  • Loading branch information...
1 parent cedea05 commit cc71df3a4b345e6a83e71b5cfec2bcc390e1d774 @drbrain drbrain committed Dec 26, 2006
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/tinderbox/gem_tinderbox.rb
View
15 lib/tinderbox/gem_tinderbox.rb
@@ -15,6 +15,8 @@ class Tinderbox::GemTinderbox
attr_accessor :root
+ attr_accessor :timeout
+
def self.process_args(args)
opts_file = File.expand_path '~/.gem_tinderbox'
options = {}
@@ -23,11 +25,13 @@ def self.process_args(args)
File.readlines(opts_file).map { |l| l.chomp.split '=', 2 }.each do |k,v|
v = true if v == 'true'
v = false if v == 'false'
+ v = Integer(v) if k == 'Timeout'
options[k.intern] = v
end
end
options[:Daemon] ||= false
+ options[:Timeout] ||= 120
opts = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename $0} [options]"
@@ -65,6 +69,14 @@ def self.process_args(args)
opts.separator ''
+ opts.on("-t", "--timeout TIMEOUT",
+ "Maximum time to wait for a gem's tests to",
+ "finish",
+ "Default: #{options[:Timeout]}",
+ Numeric) do |timeout|
+ options[:Timeout] = timeout
+ end
+
opts.on("-r", "--root ROOT",
"Root directory for gem tinderbox",
"Default: #{options[:Root]}",
@@ -106,6 +118,7 @@ def self.run(args = ARGV)
tinderbox = new options[:Server], options[:Username], options[:Password]
tinderbox.root = options[:Root]
+ tinderbox.timeout = options[:Timeout]
if options[:Daemon] then
require 'webrick/server'
@@ -126,6 +139,7 @@ def initialize(host, username, password)
@username = username
@password = password
@root = nil
+ @timeout = 120
@source_info_cache = nil
@seen_gems = []
@@ -196,6 +210,7 @@ def source_info_cache
def test_gem(spec)
runner = Tinderbox::GemRunner.new spec.name, spec.version.to_s, root
+ runner.timeout = @timeout
runner.run
end

0 comments on commit cc71df3

Please sign in to comment.
Something went wrong with that request. Please try again.