Class: Micron::Runner
- Inherits:
-
Object
- Object
- Micron::Runner
- Defined in:
- lib/micron/runner.rb,
lib/micron/runner/shim.rb,
lib/micron/runner/clazz.rb,
lib/micron/runner/debug.rb,
lib/micron/runner/method.rb,
lib/micron/runner/clazz19.rb,
lib/micron/runner/test_file.rb,
lib/micron/runner/proc_clazz.rb,
lib/micron/runner/fork_worker.rb,
lib/micron/runner/forking_clazz.rb,
lib/micron/runner/exception_info.rb,
lib/micron/runner/parallel_clazz.rb,
lib/micron/runner/process_reaper.rb,
lib/micron/runner/liveness_checker.rb,
lib/micron/runner/liveness_checker/ping.rb,
lib/micron/runner/liveness_checker/pong.rb
Overview
Default Runner - forks for each file
Direct Known Subclasses
Defined Under Namespace
Modules: Debug Classes: Clazz, ExceptionInfo, ForkWorker, ForkingClazz, LivenessChecker, Method, ParallelClazz, ProcClazz, ProcessReaper, Shim, TestFile
Constant Summary collapse
- OUT =
$stdout
- ERR =
$stderr
- PASSTHROUGH_EXCEPTIONS =
these exceptions, if caught while running, will be re-raised
[ NoMemoryError, SignalException, Interrupt, SystemExit ]
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(files, reporters) ⇒ Runner
constructor
A new instance of Runner.
-
#report(method, *args) ⇒ Object
Fire the given report event on all reporters.
- #run ⇒ Object
-
#synchronize(&block) ⇒ Object
Output synchronization helper.
Constructor Details
#initialize(files, reporters) ⇒ Runner
Returns a new instance of Runner.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/micron/runner.rb', line 29 def initialize(files, reporters) @files = files @results = [] @reporters = reporters || [] @mutex = Mutex.new if self.class.to_s != "Micron::Runner" then # Only needed in fork/proc runners TestCase.class_eval do include TestCase::TeardownCoverage end end end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
27 28 29 |
# File 'lib/micron/runner.rb', line 27 def results @results end |
Instance Method Details
#report(method, *args) ⇒ Object
Fire the given report event on all reporters
83 84 85 86 87 |
# File 'lib/micron/runner.rb', line 83 def report(method, *args) synchronize { @reporters.each { |r| r.send(method, *args) } } end |
#run ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/micron/runner.rb', line 44 def run report(:start_tests, @files) @files.each do |file| test_file = TestFile.new(file) report(:start_file, test_file) begin test_file.load(true) results = test_file.run(Clazz) rescue Exception => ex results = [ex] end 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 EasyCov.dump report(:end_tests, @files, @results) return @results end |
#synchronize(&block) ⇒ Object
Output synchronization helper. Will NOT work across forks!
90 91 92 |
# File 'lib/micron/runner.rb', line 90 def synchronize(&block) @mutex.synchronize(&block) end |