Class: Micron::ForkRunner

Inherits:
Runner
  • Object
show all
Defined in:
lib/micron/fork_runner.rb

Constant Summary

Constants inherited from Runner

Runner::ERR, Runner::OUT, Runner::PASSTHROUGH_EXCEPTIONS

Instance Attribute Summary

Attributes inherited from Runner

#results

Instance Method Summary collapse

Methods inherited from Runner

#initialize, #report, #synchronize

Constructor Details

This class inherits a constructor from Micron::Runner

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/micron/fork_runner.rb', line 10

def run
  report(:start_tests, @files)

  @files.each do |file|

    # fork for each file
    worker = ForkWorker.new(nil, false) {
      $0 = "micron: class"
      # ERR.puts "micron: class (#{$$})"

      test_file = TestFile.new(file)
      report(:start_file, test_file)

      begin
        test_file.collect_coverage()
        test_file.load()
        results = test_file.run(ForkingClazz)
      rescue Exception => ex
        results = [ex]
      end

      results
    }.run

    results = worker.wait.result
    results.each do |clazz|
      if clazz.kind_of? Exception then
        puts "Error loading test file: #{file}"
        puts clazz
        puts clazz.backtrace
        exit 1
      end

      # should be a Clazz
      @results << clazz
    end

  end

  report(:end_tests, @files, @results)

  return @results
end