lib/testr/driver.rb in testr-14.0.1 vs lib/testr/driver.rb in testr-14.0.2
- old
+ new
@@ -33,19 +33,22 @@
@master = Client::Transceiver.new('testr-master') do |line|
event, file = JSON.load(line)
case event.to_sym
when :test
+ @waiting_test_files.delete file
@running_test_files.push file
when :pass
- @passed_test_files.push file unless @passed_test_files.include? file
@running_test_files.delete file
+ @failed_test_files.delete file
+ @passed_test_files.push file unless @passed_test_files.include? file
when :fail
- @failed_test_files.push file unless @failed_test_files.include? file
@running_test_files.delete file
+ @passed_test_files.delete file
+ @failed_test_files.push file unless @failed_test_files.include? file
end
@upstream.print line
end
@@ -55,13 +58,13 @@
@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 |source_regexp, test_globber|
- if source_regexp =~ changed_file
- run_test_files Dir[test_globber.call(changed_file).to_s]
+ 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 }
@@ -85,10 +88,11 @@
def quit_herald_and_master
@herald.quit
@master.quit
end
+ @waiting_test_files = []
@running_test_files = []
@passed_test_files = []
@failed_test_files = []
def rerun_running_test_files
@@ -98,10 +102,13 @@
def run_test_files files
files.each {|f| run_test_file f }
end
def run_test_file file
- @master.send [:test, file, find_changed_test_names(file)]
+ unless @waiting_test_files.include? file
+ @waiting_test_files.push file
+ @master.send [:test, file, find_changed_test_names(file)]
+ end
end
@lines_by_file = {}
def find_changed_test_names test_file