Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 112 lines (87 sloc) 2.967 kb
092e008 @zenspider Added support for autotest.
zenspider authored
1 # -*- ruby -*-
2
2ed96fe More autotest changes
Ryan Davis authored
3 require 'autotest/timestamp'
4
5 $f = true # quickstart
6 $q = ! $v # don't print all the files unless we run -v
7
8 ENV['PRETTY'] = "1"
76b3935 @zenspider Fixed autotest support (needs latest version of zentest).
zenspider authored
9
092e008 @zenspider Added support for autotest.
zenspider authored
10 Autotest.add_hook :run_command do |at|
11 system "rake"
12 end
13
14 class Autotest
15 alias :old_ruby :ruby
16 def ruby
631adc3 added RUBY env for autotest
Ryan Davis authored
17 ENV["RUBY"] || "bin/mspec ci -fu"
092e008 @zenspider Added support for autotest.
zenspider authored
18 end
19
2ed96fe More autotest changes
Ryan Davis authored
20 alias :old_consolidate_failures :consolidate_failures
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
21 def consolidate_failures(failed)
22 filters = new_hash_of_arrays
23
24 failed.each do |spec, failed_trace|
25 failed_trace.scan(/ at ([^:]+)/).each do |file,|
26 file.sub!(/^\.\//, '')
27 next unless file =~ /^spec/
28 test_files_for(file).each do |f|
29 filters[f] # mspec doesn't have real spec filtering yet
30 end
31 break
32 end
33 end
34
35 return filters
36 end
37
2ed96fe More autotest changes
Ryan Davis authored
38 alias :old_make_test_cmd :make_test_cmd
092e008 @zenspider Added support for autotest.
zenspider authored
39 def make_test_cmd files_to_test
76b3935 @zenspider Fixed autotest support (needs latest version of zentest).
zenspider authored
40 # until bin/ci and bin/mspec allow for regexps, run the whole file again
41 classes = reorder(files_to_test).map { |k,v| k }.join(' ')
dfb772f @zenspider Activate pp only if $PRETTY set.
zenspider authored
42 "PRETTY=1 #{ruby} #{classes} | #{unit_diff}"
092e008 @zenspider Added support for autotest.
zenspider authored
43 end
44 end
45
46 Autotest.add_hook :initialize do |at|
76b3935 @zenspider Fixed autotest support (needs latest version of zentest).
zenspider authored
47 at.order = :natural
48
2ed96fe More autotest changes
Ryan Davis authored
49 at.sleep = 2
50
4d5a52d @zenspider Added extra exceptions and removed all-exclude.txt~ generator since that...
zenspider authored
51 at.add_exception(/\.rbc$/)
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
52 at.add_exception(/shotgun\/external_libs/)
45f2d6d @zenspider Added more brains to .autotest. Removed bad files that it pointed out
zenspider authored
53 at.add_exception(/README/)
8e995f2 @brixen Hopefully fix autotest config script.
brixen authored
54 at.add_exception(/spec.tags.critical.txt/)
76b3935 @zenspider Fixed autotest support (needs latest version of zentest).
zenspider authored
55
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
56 at.find_directories.clear
57 at.find_directories.push(
58 'kernel',
f05f58f Added changes to make autotest work with lib files... prolly doesn't map...
Ryan Davis authored
59 'lib',
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
60 'shotgun',
61 'spec/ruby/1.8/core',
76b3935 @zenspider Fixed autotest support (needs latest version of zentest).
zenspider authored
62 'spec/ruby/1.8/language',
f05f58f Added changes to make autotest work with lib files... prolly doesn't map...
Ryan Davis authored
63 'spec/ruby/1.8/library',
76b3935 @zenspider Fixed autotest support (needs latest version of zentest).
zenspider authored
64 'spec/compiler',
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
65 'spec/parser',
8e995f2 @brixen Hopefully fix autotest config script.
brixen authored
66 'spec/tags'
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
67 )
68
69 at.failed_results_re = /^\d+\)\n([^\n]*)(?:FAILED|ERROR)?\n(.*?)\n\n/m
70 at.completed_re = /\Z/ # FIX: some sort of summary line at the end?
092e008 @zenspider Added support for autotest.
zenspider authored
71
8e995f2 @brixen Hopefully fix autotest config script.
brixen authored
72 at.add_mapping %r%^spec/tags/(.*)_tags.txt$% do |_, m|
45f2d6d @zenspider Added more brains to .autotest. Removed bad files that it pointed out
zenspider authored
73 Dir["spec/#{m[1]}_spec.rb"]
74 end
75
c5b3580 Added fixture mapping
Ryan Davis authored
76 at.add_mapping %r%^spec/.*([^/]+)/(shared|fixtures)/% do |_, m|
77 at.files_matching(%r%^spec/.*#{m[1]}/.*_spec.rb$%)
45f2d6d @zenspider Added more brains to .autotest. Removed bad files that it pointed out
zenspider authored
78 end
79
80 at.add_mapping %r%^spec/spec_helper.rb% do
81 at.files_matching(%r%^spec/.*_spec.rb$%)
82 end
83
84 at.add_mapping %r%^spec/compiler/spec_helper.rb% do
85 at.files_matching(%r%^spec/compiler/.*_spec.rb$%)
86 end
87
88 at.add_mapping %r%^spec/parser/sexp_expectations.rb% do
89 at.files_matching(%r%^spec/parser/.*_spec.rb$%)
90 end
91
092e008 @zenspider Added support for autotest.
zenspider authored
92 at.add_mapping %r%^spec/.*_spec\.rb$% do |filename, _|
93 filename
94 end
95
96 at.add_mapping %r%^kernel/(.*)/(.*).rb$% do |_, m|
97 Dir["spec/#{m[1]}/#{m[2]}/*_spec.rb"]
98 end
99
100 at.add_mapping %r%^compiler/(bytecode|sexp|translation)/*.rb$% do |_, m|
101 Dir["spec/compiler/rubinius/*_spec.rb"] + Dir["spec/language/*_spec.rb"]
102 end
103
104 at.add_mapping %r%^lib/(.*).rb% do |_, m|
105 Dir["spec/library/#{m[1]}*_spec.rb"]
106 end
107
869f0aa More .autotest love - now bad-ass
Ryan Davis authored
108 at.add_mapping %r%^shotgun% do |_, m|
109 at.files_matching(/^spec.*_spec\.rb/)
092e008 @zenspider Added support for autotest.
zenspider authored
110 end
111 end
Something went wrong with that request. Please try again.