3 require 'autotest/timestamp'
6 $q = ! $v # don't print all the files unless we run -v
8 # TODO: puke if Autotest::Rspec is seen
12 Autotest.add_hook :run_command do |at|
19 ENV["RUBY"] || "bin/mspec ci -fu"
22 alias :old_consolidate_failures :consolidate_failures
23 def consolidate_failures(failed)
24 filters = new_hash_of_arrays
26 failed.each do |spec, failed_trace|
27 failed_trace.scan(/ at ([^:]+)/).each do |file,|
28 file.sub!(/^\.\//, '')
29 next unless file =~ /^spec/
30 test_files_for(file).each do |f|
31 filters[f] # mspec doesn't have real spec filtering yet
40 alias :old_make_test_cmd :make_test_cmd
41 def make_test_cmd files_to_test
42 # until bin/ci and bin/mspec allow for regexps, run the whole file again
43 classes = reorder(files_to_test).map { |k,v| k }.join(' ')
44 "PRETTY=1 #{ruby} #{classes} | #{unit_diff}"
48 Autotest.add_hook :initialize do |at|
53 at.add_exception(/\.rbc$/)
54 at.add_exception(/shotgun\/external_libs/)
55 at.add_exception(/README/)
56 at.add_exception(/spec.tags.critical.txt/)
58 at.find_directories.clear
59 at.find_directories.push(
64 'spec/ruby/1.8/language',
65 'spec/ruby/1.8/library',
71 at.failed_results_re = /^\d+\)\n([^\n]*)(?:FAILED|ERROR)?\n(.*?)\n\n/m
72 at.completed_re = /\Z/ # FIX: some sort of summary line at the end?
74 at.add_mapping %r%^spec/tags/(.*)_tags.txt$% do |_, m|
75 Dir["spec/#{m[1]}_spec.rb"]
78 at.add_mapping %r%^spec/(.*)/(shared|fixtures)/% do |_, m|
79 at.files_matching(%r%^spec/.*#{m[1]}/.*_spec.rb$%)
82 at.add_mapping %r%^spec/spec_helper.rb% do
83 at.files_matching(%r%^spec/.*_spec.rb$%)
86 at.add_mapping %r%^spec/compiler/spec_helper.rb% do
87 at.files_matching(%r%^spec/compiler/.*_spec.rb$%)
90 at.add_mapping %r%^spec/.*_spec\.rb$% do |filename, _|
94 at.add_mapping %r%^kernel/(.*)/(.*).rb$% do |_, m|
95 Dir["spec/#{m[1]}/#{m[2]}/*_spec.rb"]
98 at.add_mapping %r%^compiler/(bytecode|sexp|translation)/*.rb$% do |_, m|
99 Dir["spec/compiler/rubinius/*_spec.rb"] + Dir["spec/language/*_spec.rb"]
102 at.add_mapping %r%^lib/(.*).rb% do |_, m|
103 Dir["spec/library/#{m[1]}*_spec.rb"]
106 at.add_mapping %r%^shotgun% do |_, m|
107 at.files_matching(/^spec.*_spec\.rb/)