Module: TestR::Driver
Instance Method Summary collapse
- #loop ⇒ Object
- #reabsorb_overhead_files ⇒ Object
- #rerun_failed_test_files ⇒ Object
- #rerun_passed_test_files ⇒ Object
- #run_all_test_files ⇒ Object
- #stop_running_test_files ⇒ Object
Methods included from Server
Instance Method Details
#loop ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/testr/driver.rb', line 63 def loop reabsorb_overhead_files @herald = Client::Receiver.new('testr-herald') do |line| changed_file = line.chomp warn "testr-driver: herald: #{changed_file}" if $DEBUG # find and run the tests that correspond to the changed file Config.test_file_globbers.each do |regexp, globber| if regexp =~ changed_file and glob = globber.call(changed_file) run_test_files Dir[glob] end end # reabsorb text execution overhead if overhead files changed if Config.reabsorb_file_greps.any? {|r| r =~ changed_file } @client.puts JSON.dump([:over, changed_file]) # NOTE: new thread because reabsorb_overhead_files will kill this one Thread.new { reabsorb_overhead_files }.join end end super @herald.quit @master.quit end |
#reabsorb_overhead_files ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/testr/driver.rb', line 30 def reabsorb_overhead_files @master.quit if defined? @master @master = Client::Transceiver.new('testr-master') do |line| event, file, tests = JSON.load(line) case event.to_sym when :test @waiting_test_files.delete file @running_test_files.push file when :pass @running_test_files.delete file @failed_test_files.delete file if tests.empty? and not @passed_test_files.include? file @passed_test_files.push file end when :fail @running_test_files.delete file @passed_test_files.delete file @failed_test_files.push file unless @failed_test_files.include? file end @client.print line end @master.send [:load, Config.overhead_load_paths, Dir[*Config.overhead_file_globs]] rerun_running_test_files end |
#rerun_failed_test_files ⇒ Object
26 27 28 |
# File 'lib/testr/driver.rb', line 26 def rerun_failed_test_files run_test_files @failed_test_files end |
#rerun_passed_test_files ⇒ Object
22 23 24 |
# File 'lib/testr/driver.rb', line 22 def rerun_passed_test_files run_test_files @passed_test_files end |
#run_all_test_files ⇒ Object
13 14 15 |
# File 'lib/testr/driver.rb', line 13 def run_all_test_files run_test_files Dir[*Config.all_test_file_globs] end |
#stop_running_test_files ⇒ Object
17 18 19 20 |
# File 'lib/testr/driver.rb', line 17 def stop_running_test_files @master.send [:stop] @running_test_files.clear end |