dbrady-tourbus 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/tourbus +4 -1
  2. data/lib/tour_bus.rb +7 -1
  3. metadata +1 -1
data/bin/tourbus CHANGED
@@ -10,6 +10,7 @@ opts = Trollop.options do
10
10
  opt :number, "Number of times to run the tour (in each concurrent step, so -c 10 -n 10 will run the tour 100 times)", :type => :integer, :default => 1
11
11
  opt :verbose, "Run in verbose mode", :type => :boolean, :default => false
12
12
  opt :list, "List tours and runs available. If tours or runs are included, filters the list", :type => :boolean, :default => nil
13
+ opt :rand, "Random seed", :type => :integer, :default => nil
13
14
  end
14
15
 
15
16
  tours = if ARGV.empty?
@@ -18,12 +19,14 @@ tours = if ARGV.empty?
18
19
  ARGV
19
20
  end
20
21
 
22
+ srand opts[:rand] || Time.now.to_i
23
+
21
24
  if opts[:list]
22
25
  Tour.tours(ARGV).each do |tour|
23
26
  puts tour
24
27
  puts Tour.tests(tour).map {|test| " #{test}"}
25
28
  end
26
29
  else
27
- puts Benchmark.measure { TourBus.new(opts[:host], opts[:concurrency], opts[:number], tours).run }
30
+ puts TourBus.new(opts[:host], opts[:concurrency], opts[:number], tours).run
28
31
  end
29
32
 
data/lib/tour_bus.rb CHANGED
@@ -36,11 +36,16 @@ class TourBus < Monitor
36
36
  Dir[File.join('.', 'tours', '**', '*.rb')].map {|fn| File.basename(fn, ".rb")}.select {|fn| filter.size.zero? || filter.any?{|f| fn =~ /#{f}/}}
37
37
  end
38
38
 
39
+ def total_runs
40
+ tours.size * concurrency * number
41
+ end
42
+
39
43
  def run
40
44
  threads = []
45
+ tour_name = "#{total_runs} runs: #{concurrency}x#{number} of #{tours * ','}"
41
46
  started = Time.now.to_f
42
47
  concurrency.times do |conc|
43
- log "Starting #{concurrency} runners to run #{tours.size} tours #{number} times (for a total of #{tours.size*concurrency*number} times)"
48
+ log "Starting #{tour_name}"
44
49
  threads << Thread.new do
45
50
  runner_id = next_runner_id
46
51
  runs,passes,fails,errors,start = 0,0,0,0,Time.now.to_f
@@ -59,6 +64,7 @@ class TourBus < Monitor
59
64
  threads.each {|t| t.join }
60
65
  finished = Time.now.to_f
61
66
  log '-' * 80
67
+ log tour_name
62
68
  log "All Runners finished."
63
69
  log "Total Runs: #{@runs}"
64
70
  log "Total Passes: #{@passes}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbrady-tourbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Brady