Change soft-fail to use the config, rather than env
[rbx.git] / .autotest
blobbc83016cd3c9cc42ab048dffd3937c01dc02e742
1 # -*- ruby -*-
3 require 'autotest/timestamp'
5 $f = true # quickstart
6 $q = ! $v # don't print all the files unless we run -v
8 # TODO: puke if Autotest::Rspec is seen
10 ENV['PRETTY'] = "1"
12 Autotest.add_hook :run_command do |at|
13   system "rake"
14 end
16 class Autotest
17   alias :old_ruby :ruby
18   def ruby
19     ENV["RUBY"] || "bin/mspec ci -fu"
20   end
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
32           end
33         break
34       end
35     end
37     return filters
38   end
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}"
45   end
46 end
48 Autotest.add_hook :initialize do |at|
49   at.order = :natural
51   at.sleep = 2
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(
60                            'kernel',
61                            'lib',
62                            'shotgun',
63                            'spec/ruby/1.8/core',
64                            'spec/ruby/1.8/language',
65                            'spec/ruby/1.8/library',
66                            'spec/compiler',
67                            'spec/parser',
68                            'spec/tags'
69                            )
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"]
76   end
78   at.add_mapping %r%^spec/(.*)/(shared|fixtures)/% do |_, m|
79     at.files_matching(%r%^spec/.*#{m[1]}/.*_spec.rb$%)
80   end
82   at.add_mapping %r%^spec/spec_helper.rb% do
83     at.files_matching(%r%^spec/.*_spec.rb$%)
84   end
86   at.add_mapping %r%^spec/compiler/spec_helper.rb% do
87     at.files_matching(%r%^spec/compiler/.*_spec.rb$%)
88   end
90   at.add_mapping %r%^spec/.*_spec\.rb$% do |filename, _|
91     filename
92   end
94   at.add_mapping %r%^kernel/(.*)/(.*).rb$% do |_, m|
95     Dir["spec/#{m[1]}/#{m[2]}/*_spec.rb"]
96   end
98   at.add_mapping %r%^compiler/(bytecode|sexp|translation)/*.rb$% do |_, m|
99     Dir["spec/compiler/rubinius/*_spec.rb"] + Dir["spec/language/*_spec.rb"]
100   end
102   at.add_mapping %r%^lib/(.*).rb% do |_, m|
103     Dir["spec/library/#{m[1]}*_spec.rb"]
104   end
106   at.add_mapping %r%^shotgun% do |_, m|
107     at.files_matching(/^spec.*_spec\.rb/)
108   end