Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 692 lines (621 sloc) 21.728 kb
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
1 require 'rake/classic_namespace'
2 require 'rake/clean'
3
4 CLEAN.include('gen_*.pir')
5 CLEAN.include('*/gen_*.pir')
6 CLEAN.include('*/*/gen_*.pir')
7 CLEAN.include('Test.pir')
8 CLEAN.include('build.yaml')
9 CLEAN.include('*.c')
10 CLEAN.include('*.o')
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
11 CLEAN.include('report')
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
12 CLOBBER.include('cardinal')
13 CLOBBER.include('*.pbc')
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
14 CLOBBER.include('report.tar.gz')
5b7ce29 Anan Mikami Add new rake tasks
lateau authored
15 CLOBBER.include(['ctags_opt', 'tags'])
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
16
57e210d Joeri Samson Make parameters of two Rakefile constants
joeri authored
17 DEBUG = ENV['debug'] || false
18 ALTERNATIVE_RUBY = ENV['test_with'] || false
5e1d506 Ted Reed Provide method for overriding parrot_config detection via environment va...
treed authored
19 PARROT_CONFIG = ENV["PARROT_CONFIG"] || 'parrot_config'
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
20 $config = {}
9ce1198 Anan Mikami block in top error in ruby1.9
lateau authored
21 $location = {
22 :parrot => "/parrot",
23 :perl6grammar => "/runtime/parrot/library/PGE/Perl6Grammar.pbc",
24 :nqp => "/runtime/parrot/library/nqp-rx.pbc",
25 :pct => "/runtime/parrot/library/PCT.pbc",
26 :pbc_to_exe => "/pbc_to_exe"
27 }
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
28 $tests = 0
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
29 $test_files = 0
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
30 $ok = 0
31 $nok = 0
32 $unknown = 0
33 $failures = 0
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
34 $expected_failures = 0
35 $unexpected_failures = []
36 $unexpected_passes = 0
37 $u_p_files = []
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
38 $missing = 0
39 $missing_files = []
40 $toomany = 0
41 $toomany_files = []
be5f3c4 Ted Reed Make the test harness watch for "See issue" messages and report how many...
treed authored
42 $issue_counts = Hash.new(0)
43 $issue_lacks = 0
44 $i_l_files = []
8d2377f Ted Reed Fix the Rakefile so that test suites will still complete if individual f...
treed authored
45 $comp_fails = 0
46 $c_f_files = []
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
47 $pl = false
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
48 $start = Time.now
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
49 $meta = Hash.new
50 $report = false
38f6a07 Ted Reed Add new build system.
treed authored
51
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
52 def clean?
53 return false if $nok > $expected_failures
54 return false if $failures > 0
55 return false if $unknown > 0
56 return false if $missing > 0
57 return false if $toomany > 0
be5f3c4 Ted Reed Make the test harness watch for "See issue" messages and report how many...
treed authored
58 return false if $issue_lacks > 0
8d2377f Ted Reed Fix the Rakefile so that test suites will still complete if individual f...
treed authored
59 return false if $comp_fails > 0
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
60 return true
61 end
62
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
63 def pl(word)
64 $pl ? word + "s" : word
65 end
66
67 def were
68 $pl ? "were" : "was"
69 end
70
71 def are
72 $pl ? "are" : "is"
73 end
74
75 def them
76 $pl ? "them" : "it"
77 end
78
0173911 Ted Reed A few minor fixes to the Rakefile.
treed authored
79 def parrot(input, output="", grammar="", target="")
38f6a07 Ted Reed Add new build system.
treed authored
80 target = "--target=#{target}" if target != ""
0173911 Ted Reed A few minor fixes to the Rakefile.
treed authored
81 output = "-o #{output}" if output != ""
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
82 puts "Running parrot: #{$config[:parrot]} #{grammar} #{target} #{output} #{input}" if DEBUG
83 sh "#{$config[:parrot]} #{grammar} #{target} #{output} #{input}"
38f6a07 Ted Reed Add new build system.
treed authored
84 end
85
86 def make_exe(pbc)
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
87 sh "#{$config[:pbc_to_exe]} cardinal.pbc"
38f6a07 Ted Reed Add new build system.
treed authored
88 end
89
90 def test(file, name="")
f09fc6d Ted Reed Minor change to debug output of Rakefile.
treed authored
91 print "Adding #{file} as a test " if DEBUG
869b38d Ted Reed Make it so you can twiddle a global to run tests against CRuby instead o...
treed authored
92 pir_file = file.gsub(/.t$/,'.pir')
7e2651e Ted Reed Adjust filename for generated test files so that .gitignore catches them...
treed authored
93 if pir_file =~ /\//
94 pir_file.gsub!(/\/([^\/]+)$/) {"/gen_#$1"}
95 else
96 pir_file = "gen_#{pir_file}"
97 end
38f6a07 Ted Reed Add new build system.
treed authored
98 if name == ""
99 name = file.gsub(/.t$/,'').gsub(/^[0-9]+-/,'').gsub(/-/,'').gsub(/.*\//,'')
100 end
57e210d Joeri Samson Make parameters of two Rakefile constants
joeri authored
101 if ALTERNATIVE_RUBY
869b38d Ted Reed Make it so you can twiddle a global to run tests against CRuby instead o...
treed authored
102 task name do
103 run_test file
104 end
105 else
c23a004 Ted Reed Adjust what Rake tests use to determine if the parser's been changed.
treed authored
106 file "t/#{pir_file}" => [:config, "t/#{file}", "src/gen_actions.pir", "src/gen_grammar.pir"] do
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
107 unless File.exists?('cardinal.pbc')
108 Task['cardinal.pbc'].invoke
109 end
8d2377f Ted Reed Fix the Rakefile so that test suites will still complete if individual f...
treed authored
110 begin
111 parrot("t/#{file}", "t/#{pir_file}", "cardinal.pbc", "pir")
112 rescue RuntimeError
113 File.open("t/#{pir_file}",'w') do |f|
114 f.write(".sub main :main\nsay 'FAILED TO COMPILE'\n.end")
115 end
116 end
869b38d Ted Reed Make it so you can twiddle a global to run tests against CRuby instead o...
treed authored
117 end
118 puts "named #{name}" if DEBUG
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
119 task name => [:config, "t/#{pir_file}", "cardinal.pbc", "Test.pir"] do |t|
120 run_test pir_file, "#{t.scope.join(':')}:#{name}"
869b38d Ted Reed Make it so you can twiddle a global to run tests against CRuby instead o...
treed authored
121 end
38f6a07 Ted Reed Add new build system.
treed authored
122 end
123 end
124
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
125 def get_report_file(filename)
126 dir = "report/t/" + File.dirname(filename)
127 dir.gsub!(/\/\./, '')
128 mkdir_p(dir)
129 ext = File.extname(filename)
130 fn = dir + "/" + File.basename(filename, ext)
131 fn += ".t"
132 fn.gsub!(/gen_/,'')
133 f = File.new(fn, 'w')
134 $meta['file_order'] += [fn.gsub(/report\//,'')]
135 return f
136 end
137
7e2651e Ted Reed Adjust filename for generated test files so that .gitignore catches them...
treed authored
138 def run_test(file,name="")
38f6a07 Ted Reed Add new build system.
treed authored
139 puts file if DEBUG
7e2651e Ted Reed Adjust filename for generated test files so that .gitignore catches them...
treed authored
140 name = file if name == ""
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
141 $test_files += 1
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
142 command = ALTERNATIVE_RUBY || $config[:parrot]
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
143 report_file = get_report_file(file) if $report
869b38d Ted Reed Make it so you can twiddle a global to run tests against CRuby instead o...
treed authored
144 IO.popen("#{command} t/#{file}", "r") do |t|
38f6a07 Ted Reed Add new build system.
treed authored
145 begin
146 plan = t.readline
147 rescue EOFError
148 plan = "x"
149 end
150 puts plan if DEBUG
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
151 report_file.write(plan) if $report
38f6a07 Ted Reed Add new build system.
treed authored
152 if plan =~ /^1\.\.([0-9]+)/
153 tests = $1.to_i
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
154 $tests += tests
38f6a07 Ted Reed Add new build system.
treed authored
155 result = "#{$1} tests... "
156 ok = 0
157 nok = 0
158 unknown = 0
159 test = 0
160 t.readlines.each do |line|
161 test += 1
162 puts line if DEBUG
ad14323 Ted Reed Some code for the report target wasn't properly guarded. treed--
treed authored
163 report_file.write(line) if $report
38f6a07 Ted Reed Add new build system.
treed authored
164 if line =~ /^ok #{test}/
165 ok += 1
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
166 if line =~ /TODO/
167 $unexpected_passes += 1
168 $u_p_files += [file]
169 end
38f6a07 Ted Reed Add new build system.
treed authored
170 else
171 if line =~ /^not ok #{test}/
172 nok += 1
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
173 if line =~ /(TODO|SKIP)/
174 $expected_failures += 1
be5f3c4 Ted Reed Make the test harness watch for "See issue" messages and report how many...
treed authored
175 if line =~ /See issue #([0-9]+)/
176 $issue_counts[$1] += 1
177 else
178 puts "Lacks issue." if DEBUG
179 $issue_lacks += 1
180 $i_l_files += [file]
181 end
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
182 else
183 $unexpected_failures += [file]
184 end
38f6a07 Ted Reed Add new build system.
treed authored
185 else
186 unknown += 1
187 end
188 end
189 end
190 result += "#{ok} ok "
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
191 $ok += ok
38f6a07 Ted Reed Add new build system.
treed authored
192 result += "#{nok} not ok"
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
193 $nok += nok
38f6a07 Ted Reed Add new build system.
treed authored
194 result += " #{unknown} unknown" if unknown > 0
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
195 $unknown += unknown
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
196 if test < tests
197 result += " MISSING TESTS"
198 $missing += 1
199 $missing_files += [file]
200 end
201 if test > tests
202 result += " TOO MANY TESTS"
203 $toomany += 1
204 $toomany_files += [file]
205 end
38f6a07 Ted Reed Add new build system.
treed authored
206 else
8d2377f Ted Reed Fix the Rakefile so that test suites will still complete if individual f...
treed authored
207 if plan =~ /FAILED TO COMPILE/
208 result = "Complete failure... failed to compile."
209 $comp_fails += 1
210 $c_f_files += [file]
211 else
212 result = "Complete failure... no plan given"
213 end
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
214 $failures += 1
38f6a07 Ted Reed Add new build system.
treed authored
215 end
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
216 report_file.close if $report
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
217 puts "Running #{name} #{result}"
38f6a07 Ted Reed Add new build system.
treed authored
218 end
219 end
220
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
221 desc "Produce a TAP archive"
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
222 task "report.tar.gz" do
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
223 $report = true
224 $meta['start_time'] = Time.now.to_i
225 $meta['file_order'] = Array.new
226 Task['test:all'].invoke
227 $meta['stop_time'] = Time.now.to_i
7ccf0ae Ted Reed Adds the architecture, branch, and platform extra_properties to the TAP ...
treed authored
228 $meta['extra_properties'] = {
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
229 'Architecture' => get_arch,
230 'Platform' => get_platform,
231 'Branch' => get_branch,
232 'Submitter' => get_submitter,
233 'Commit' => get_commit
7ccf0ae Ted Reed Adds the architecture, branch, and platform extra_properties to the TAP ...
treed authored
234 }
c25a9e2 Ted Reed Add Parrot Revision to smolder report, and adjust method for getting com...
treed authored
235
236 IO.popen("#{PARROT_CONFIG} revision", "r") do |p|
46b861f Ted Reed Move the Parrot Revision to its proper place. (jdv79++)
treed authored
237 $meta['extra_properties']['Parrot Revision'] = p.readline.chomp.to_i
c25a9e2 Ted Reed Add Parrot Revision to smolder report, and adjust method for getting com...
treed authored
238 end
239
eb932f5 Ted Reed Add report target that generates a TAP archive.
treed authored
240 require 'yaml'
241 File.open('report/meta.yml','w') do |f|
242 YAML::dump($meta, f)
243 end
244 chdir 'report'
245 sh 'tar cfz ../report.tar.gz *'
246 chdir '..'
247 end
248
870ad48 Ted Reed Add a smolder target to the Rakefile to submit report.tar.gz to the appr...
treed authored
249 desc "Submit a smolder report."
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
250 task :smolder => "report.tar.gz" do
e770a4e Stephen Weeks Fix smolder submissions. lateu++
tene authored
251 puts 'Creating a smolder report. This will take only a few minutes...', ''
252
253 command = 'curl '
254 contents = {
255 :username => 'parrot-autobot',
256 :password => 'qa_rocks',
257 :comments => 'Submit a smolder report.',
258 :architecture => "#{get_arch}",
259 :revision => "#{get_commit}",
260 :report_file => '@report.tar.gz'
261 }
262 url = 'http://smolder.parrot.org/app/projects/process_add_report/10'
263
264 contents.each do |k, v|
265 command << %Q(-F "#{k.to_s}=#{v}" )
266 end
267 command << url
268 `#{command} || exit 1`
269
270 if $?.exitstatus == 0
2a5c349 Bob Kuo whoops, actually fix these things lateau++
bubaflub authored
271 puts 'Your report sumitted.', 'You can see other recent reports at http://smolder.parrot.org/app/projects/smoke_reports/10'
e770a4e Stephen Weeks Fix smolder submissions. lateu++
tene authored
272 else
2a5c349 Bob Kuo whoops, actually fix these things lateau++
bubaflub authored
273 puts 'Error occurred. Please contact Cardinal Team.', '#cardinal on irc.parrot.org'
e770a4e Stephen Weeks Fix smolder submissions. lateu++
tene authored
274 end
870ad48 Ted Reed Add a smolder target to the Rakefile to submit report.tar.gz to the appr...
treed authored
275 end
276
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
277 desc "Determine configuration information"
38f6a07 Ted Reed Add new build system.
treed authored
278 task :config => "build.yaml" do
279 require 'yaml'
280 File.open("build.yaml","r") do |f|
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
281 $config.update(YAML.load(f))
38f6a07 Ted Reed Add new build system.
treed authored
282 end
9ce1198 Anan Mikami block in top error in ruby1.9
lateau authored
283
284 puts "Configuring..."
285 puts "build_dir is #{$config[:build_dir]}"
286 err_msg = []
287
288 err_msg << $location[:parrot] unless File.exist?($config[:parrot])
289 err_msg << $location[:perl6grammar] unless File.exist?($config[:perl6grammar])
290 err_msg << $location[:nqp] unless File.exist?($config[:nqp])
291 err_msg << $location[:pct] unless File.exist?($config[:pct])
292 err_msg << $location[:pbc_to_exe] unless File.exist?($config[:pbc_to_exe])
293
294 if err_msg.size > 0
295 err_msg = err_msg.map {|c| 'build_dir' + c + ' does not exist'}
296 abort "aborted!\n" + err_msg.join("\n")
297 end
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
298 end
299
300 def get_arch
301 `uname -p`.chomp
302 end
303
304 def get_platform
305 `uname -s`.chomp
306 end
307
308 def get_branch
309 `git status`.split('\n')[0].split(' ')[3]
310 end
311
312 def get_submitter
313 submitter = ENV['SMOLDER_SUBMITTER']
314 submitter = "#{`git config --get user.name`} <#{`git config --get user.email`}>" if submitter == ''
e1037c8 Ted Reed Ensure that get_submitter always returns something. (jdv79++)
treed authored
315 return submitter
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
316 end
317
318 def get_commit
c25a9e2 Ted Reed Add Parrot Revision to smolder report, and adjust method for getting com...
treed authored
319 `git log -1 --pretty=format:%H`.chomp
38f6a07 Ted Reed Add new build system.
treed authored
320 end
321
322 file "build.yaml" do
323 require 'yaml'
324 config = {}
5e1d506 Ted Reed Provide method for overriding parrot_config detection via environment va...
treed authored
325 IO.popen("#{PARROT_CONFIG} build_dir", "r") do |p|
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
326 $config[:build_dir] = p.readline.chomp
38f6a07 Ted Reed Add new build system.
treed authored
327 end
5e1d506 Ted Reed Provide method for overriding parrot_config detection via environment va...
treed authored
328 print PARROT_CONFIG == 'parrot_config' ? "Detected " : "Provided "
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
329 puts "parrot_config reports that build_dir is #{$config[:build_dir]}."
330
9ce1198 Anan Mikami block in top error in ruby1.9
lateau authored
331 $config[:parrot] = $config[:build_dir] + $location[:parrot]
332 $config[:perl6grammar] = $config[:build_dir] + $location[:perl6grammar]
333 $config[:nqp] = $config[:build_dir] + $location[:nqp]
334 $config[:pct] = $config[:build_dir] + $location[:pct]
c2ad937 Anan Mikami fix: coding miss in Rakefile:335
lateau authored
335 $config[:pbc_to_exe] = $config[:build_dir] + $location[:pbc_to_exe]
38f6a07 Ted Reed Add new build system.
treed authored
336
337 File.open("build.yaml","w") do |f|
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
338 YAML.dump($config, f)
38f6a07 Ted Reed Add new build system.
treed authored
339 end
340 end
341
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
342 desc "Make the cardinal binary."
38f6a07 Ted Reed Add new build system.
treed authored
343 file "cardinal" => [:config, "cardinal.pbc"] do
344 make_exe("cardinal.pbc")
345 end
346
347 sources = FileList.new('cardinal.pir',
348 'src/parser/quote_expression.pir',
349 'src/gen_grammar.pir',
350 'src/gen_actions.pir',
351 'src/gen_builtins.pir')
352
353 file "cardinal.pbc" => sources do
354 parrot("cardinal.pir","cardinal.pbc")
355 end
356
357 file "src/gen_grammar.pir" => [:config, 'src/parser/grammar.pg'] do
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
358 parrot("src/parser/grammar.pg", "src/gen_grammar.pir", $config[:perl6grammar])
38f6a07 Ted Reed Add new build system.
treed authored
359 end
360
361 file "src/gen_actions.pir" => [:config, "src/parser/actions.pm"] do
7d77922 Ted Reed Refactor the Rakefile a little.
treed authored
362 parrot("src/parser/actions.pm","src/gen_actions.pir",$config[:nqp],'pir')
38f6a07 Ted Reed Add new build system.
treed authored
363 end
364
c4f6029 Anan Mikami modify src/parser/actions.pm to return CardinalFloat instead Float:
lateau authored
365 builtins = FileList.new("src/builtins/guts.pir", "src/builtins/control.pir", "src/builtins/say.pir", "src/builtins/cmp.pir", "src/builtins/op.pir", "src/classes/Object.pir", "src/classes/Exception.pir", "src/classes/NilClass.pir", "src/classes/String.pir", "src/classes/Numeric.pir", "src/classes/Integer.pir", "src/classes/Float.pir", "src/classes/Array.pir", "src/classes/Hash.pir", "src/classes/Range.pir", "src/classes/TrueClass.pir", "src/classes/FalseClass.pir", "src/classes/Kernel.pir", "src/classes/Time.pir", "src/classes/Math.pir", "src/classes/GC.pir", "src/classes/IO.pir", "src/classes/Proc.pir", "src/classes/File.pir", "src/classes/FileStat.pir", "src/classes/Dir.pir", "src/builtins/globals.pir", "src/builtins/eval.pir", "src/classes/Continuation.pir")
38f6a07 Ted Reed Add new build system.
treed authored
366
7f387b6 Ted Reed Fixes to the Rakefile. Make it generate Test.pir when needed, and fix so...
treed authored
367 file "src/gen_builtins.pir" => builtins do
368 puts "Generating src/gen_builtins.pir"
38f6a07 Ted Reed Add new build system.
treed authored
369 File.open('src/gen_builtins.pir','w') do |f|
370 builtins.each do |b|
371 f.write(".include \"#{b}\"\n")
372 end
373 end
374 end
375
7f387b6 Ted Reed Fixes to the Rakefile. Make it generate Test.pir when needed, and fix so...
treed authored
376 file "Test.pir" => ["cardinal.pbc", "Test.rb"] do
377 parrot("Test.rb", "Test.pir", "cardinal.pbc", "pir")
378 end
379
380 task :default => ["cardinal", "Test.pir"]
38f6a07 Ted Reed Add new build system.
treed authored
381
5b7ce29 Anan Mikami Add new rake tasks
lateau authored
382 def get_ctags
383 ctags = `which ctags`.chomp
384
385 # any of exit statuses except 0 are fault
386 unless $?.exitstatus == 0
387 puts "Exuberant Ctags is needed to generates tags file."
388 exit 1
389 end
390
391 unless `#{ctags} --version`.scan(/Exuberant Ctags/).size > 0
392 puts "You have other version of ctags. Make sure Exuberant Ctags be current ctags instead of your own."
393 exit 1
394 end
395
396 ctags
397 end
398
399 namespace :tags do
400 desc "Generate ctags option file"
401 task :gen_option do
402 File.open "./ctags_opt", "w" do |f|
403 f.write "-f tags\n"
404 f.write "-R\n"
405 f.write "--totals\n"
406 f.write "--exclude=.git\n"
407 f.write "--exclude=.gitignore\n"
408 f.write "--exclude=*~\n"
409 f.write "--exclude=*.swp\n"
410 f.write "--exclude=*.rb\n"
411 f.write "--langdef=Parrot\n"
9ce1198 Anan Mikami block in top error in ruby1.9
lateau authored
412 f.write "--langmap=Parrot:+.pir.pg.pasm.pmc\n"
5b7ce29 Anan Mikami Add new rake tasks
lateau authored
413 f.write "--sort=yes\n"
414 f.write '--regex-Parrot=/^\.sub[ \t]*\'?(infix:)*([a-zA-Z0-9!#$%&*+,.\/:;<=>?@^_`\{\|\}~\-]+)\'?[ \t]*.*/\2/s,subroutine,subroutines/'
415 f.write "\n"
416 f.write '--regex-Parrot=/^rule[ \t]*([a-zA-Z0-9_]+)[ \t]*(:\"[a-zA-Z0-9!#$%&*+,.\/:;<=>?@^_`\{\|\}~\-]+\"*)*/\1/r,rule,rules/'
417 f.write "\n"
418 f.write '--regex-Parrot=/^token[ \t]*([a-zA-Z0-9_]+)[ \t]*(:\"[a-zA-Z0-9!#$%&*+,.\/:;<=>?@^_`\{\|\}~\-]+\"*)*/\1/r,token,tokens/'
419 end
420 puts "ctags_opt has been created"
421 end
422
423 desc "Generate tags for vim"
424 task :vim => [:gen_option] do
425 ctags = get_ctags
426 `#{ctags} --options=ctags_opt .`
427 FileUtils.rm_f "./ctags_opt"
428 end
429
430 desc "Generate tags for emacs"
431 task :emacs => [:gen_option] do
432 ctags = get_ctags
433 `#{ctags} -e --options=ctags_opt .`
434 FileUtils.rm_f "./ctags_opt"
435 end
436 end
437
38f6a07 Ted Reed Add new build system.
treed authored
438 namespace :test do |ns|
439 test "00-sanity.t"
440 test "01-stmts.t"
441 test "02-functions.t"
442 test "03-return.t"
443 test "04-indexed.t"
444 test "05-op-cmp.t"
445 test "07-loops.t"
446 test "08-class.t"
447 test "09-test.t"
448 test "10-regex.t"
449 test "11-slurpy.t"
450 test "12-gather.t"
451 test "99-other.t"
452 test "alias.t"
453 test "assignment.t"
454 test "blocks.t"
0d2b4be Ted Reed Add some == operator functions for comparing TrueClass and FalseClass, a...
treed authored
455 test "bool.t"
38f6a07 Ted Reed Add new build system.
treed authored
456 test "constants.t"
457 test "continuation.t"
458 test "freeze.t"
459 test "gc.t"
460 test "nil.t"
461 test "proc.t"
462 test "range.t"
463 test "splat.t"
464 test "time.t"
465 test "yield.t"
466 test "zip.t"
467
468 namespace :array do
469 test "array/array.t"
58f7557 Danius Michaelides Added support for index,count and range versions of []=. Tests included...
dtm authored
470 test "array/assign.t"
38f6a07 Ted Reed Add new build system.
treed authored
471 test "array/at.t"
472 test "array/clear.t"
473 test "array/collect.t"
db1ff47 Ted Reed Implement Array.compact and .compact!; tests included.
treed authored
474 test "array/compact.t"
74ff9b6 Ted Reed Add tests for the things I've implemented lately where they didn't alrea...
treed authored
475 test "array/concat.t"
a2b5f4d Danius Michaelides Implement Array#count() - new to ruby 1.9.
dtm authored
476 test "array/count.t"
38f6a07 Ted Reed Add new build system.
treed authored
477 test "array/delete.t"
478 test "array/empty.t"
479 test "array/equals.t"
d830bad Danius Michaelides Implement Array#fetch() with test.
dtm authored
480 test "array/fetch.t"
38f6a07 Ted Reed Add new build system.
treed authored
481 test "array/fill.t"
482 test "array/first.t"
483 test "array/flatten.t"
484 test "array/grep.t"
485 test "array/include.t"
63aa1d8 Danius Michaelides Implement Array.index/rindex, with tests.
dtm authored
486 test "array/index.t"
eca2172 Danius Michaelides Partial implementation of Array#insert().
dtm authored
487 test "array/insert.t"
38f6a07 Ted Reed Add new build system.
treed authored
488 test "array/intersection.t"
489 test "array/join.t"
490 test "array/mathop.t"
491 test "array/pop.t"
ba72bd4 Danius Michaelides Correct return value for Array, inc tests.
dtm authored
492 test "array/push.t"
741da70 Joeri Samson Implement Array.reject and .reject!; tests included.
joeri authored
493 test "array/reject.t"
3508b5e Danius Michaelides Implement Array#replace() with tests.
dtm authored
494 test "array/replace.t"
38f6a07 Ted Reed Add new build system.
treed authored
495 test "array/reverse.t"
f33b494 Danius Michaelides Implement Array#select.
dtm authored
496 test "array/select.t"
38f6a07 Ted Reed Add new build system.
treed authored
497 test "array/shift.t"
498 test "array/slice.t"
499 test "array/sort.t"
500 test "array/to_s.t"
501 test "array/uniq.t"
cc4f210 Danius Michaelides Implementation of Array.values_at, with tests.
dtm authored
502 test "array/values_at.t"
38f6a07 Ted Reed Add new build system.
treed authored
503 test "array/warray.t"
504
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
505 desc "Run tests on Array."
f33b494 Danius Michaelides Implement Array#select.
dtm authored
506 task :all => [:array, :assign, :at, :clear, :collect, :compact, :concat, :count, :delete, :empty, :equals, :fetch, :fill, :first, :flatten, :grep, :include, :index, :insert, :intersection, :join, :mathop, :pop, :push, :reject, :replace, :reverse, :select, :shift, :slice, :sort, :to_s, :uniq, :values_at, :warray]
38f6a07 Ted Reed Add new build system.
treed authored
507 end
508
509 namespace :file do
510 test "file/dir.t"
511 test "file/file.t"
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
512 test "file/stat.t"
38f6a07 Ted Reed Add new build system.
treed authored
513
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
514 desc "Run tests on File."
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
515 task :all => [:dir, :file, :stat]
38f6a07 Ted Reed Add new build system.
treed authored
516 end
517
518 namespace :hash do
74ff9b6 Ted Reed Add tests for the things I've implemented lately where they didn't alrea...
treed authored
519 test "hash/hash.t"
520 test "hash/exists.t"
38f6a07 Ted Reed Add new build system.
treed authored
521
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
522 desc "Run tests on Hash."
74ff9b6 Ted Reed Add tests for the things I've implemented lately where they didn't alrea...
treed authored
523 task :all => [:hash, :exists]
38f6a07 Ted Reed Add new build system.
treed authored
524 end
525
526 namespace :integer do
527 test "integer/integer.t"
528 test "integer/times.t"
74ff9b6 Ted Reed Add tests for the things I've implemented lately where they didn't alrea...
treed authored
529 test "integer/cmp.t"
ef84b79 Anan Mikami Integer#pred
lateau authored
530 test "integer/pred.t"
4ea63c3 Anan Mikami Integer#chr
lateau authored
531 test "integer/chr.t"
c4f6029 Anan Mikami modify src/parser/actions.pm to return CardinalFloat instead Float:
lateau authored
532 test "integer/odd.t"
533 test "integer/even.t"
534 test "integer/round.t"
38f6a07 Ted Reed Add new build system.
treed authored
535
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
536 desc "Run tests on Integer."
c4f6029 Anan Mikami modify src/parser/actions.pm to return CardinalFloat instead Float:
lateau authored
537 task :all => [:integer, :times, :cmp, :pred, :chr, :odd, :even, :round]
538 end
539
540 namespace :numeric do
541 desc "Run tests on Numeric."
542 task :all
543 end
544
545 namespace :float do
546 test "float/to_f.t"
547 test "float/zero.t"
3f1bd7a Anan Mikami new methods
lateau authored
548 test "float/eql.t"
549 test "float/flo_eq.t"
c4f6029 Anan Mikami modify src/parser/actions.pm to return CardinalFloat instead Float:
lateau authored
550
551 desc "Run tests on Float"
3f1bd7a Anan Mikami new methods
lateau authored
552 task :all => [:to_f, :zero, :eql, :flo_eq]
38f6a07 Ted Reed Add new build system.
treed authored
553 end
554
555 namespace :kernel do
556 test "kernel/exit.t"
557 test "kernel/open.t"
558 test "kernel/sprintf.t"
559
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
560 desc "Run tests on Kernel."
38f6a07 Ted Reed Add new build system.
treed authored
561 task :all => [:exit, :open, :sprintf]
562 end
563
564 namespace :math do
565 test "math/functions.t"
566
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
567 desc "Run tests on Math."
38f6a07 Ted Reed Add new build system.
treed authored
568 task :all => [:functions]
569 end
570
571 namespace :range do
572 test "range/each.t"
573 test "range/infix-exclusive.t"
574 test "range/infix-inclusive.t"
575 test "range/membership-variants.t"
576 test "range/new.t"
577 test "range/to_a.t"
578 test "range/to_s.t"
579 test "range/tofrom-variants.t"
580
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
581 desc "Run tests on Range."
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
582 task :all => [:each, :infixexclusive, :infixinclusive, :membershipvariants, :new, :to_a, :to_s, :tofromvariants]
38f6a07 Ted Reed Add new build system.
treed authored
583 end
584
585 namespace :string do
586 test "string/add.t"
587 test "string/block.t"
588 test "string/capitalize.t"
589 test "string/chops.t"
590 test "string/cmp.t"
591 test "string/concat.t"
592 test "string/downcase.t"
7f9db1a Ted Reed Implement String.empty? with tests.
treed authored
593 test "string/empty.t"
38f6a07 Ted Reed Add new build system.
treed authored
594 test "string/eq.t"
595 test "string/mult.t"
596 test "string/new.t"
597 test "string/quote.t"
598 test "string/random_access.t"
599 test "string/reverse.t"
600 test "string/upcase.t"
601
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
602 desc "Run tests on String."
7f9db1a Ted Reed Implement String.empty? with tests.
treed authored
603 task :all => [:add, :block, :capitalize, :chops, :cmp, :concat, :downcase, :empty, :eq, :mult, :new, :quote, :random_access, :reverse, :upcase]
38f6a07 Ted Reed Add new build system.
treed authored
604 end
605
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
606 desc "Run basic tests."
c34b8a6 Ted Reed Properly fix == with bools. (joeri++) Also adds some tests and adds test...
treed authored
607 task :basic => [:sanity, :stmts, :functions, :return, :indexed, :opcmp, :loops, :class, :test, :regex, :slurpy, :gather, :other, :alias, :assignment, :bool, :blocks, :constants, :continuation, :freeze, :gc, :nil, :proc, :range, :splat, :time, :yield, :zip]
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
608
609 desc "Run the entire test suite."
74ff9b6 Ted Reed Add tests for the things I've implemented lately where they didn't alrea...
treed authored
610 task :all => [:basic, "array:all", "file:all", "hash:all", "integer:all", "kernel:all", "math:all", "range:all", "string:all"] do
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
611 dur_seconds = Time.now.to_i - $start.to_i
612 dur_minutes = 0
613 while dur_seconds > 60
614 dur_seconds -= 60
615 dur_minutes += 1
616 end
617 puts "Test statistics:"
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
618 puts " The test suite took #{dur_minutes}:#{dur_seconds}."
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
619 puts " #{$tests} tests were run, from #{$test_files} files."
4d319ce Ted Reed Fix typo in Rakefile.
treed authored
620 puts " #{$ok} tests passed, #{$unexpected_passes} of which were unexpected."
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
621 unless $u_p_files.empty?
622 $u_p_files.uniq!
0173911 Ted Reed A few minor fixes to the Rakefile.
treed authored
623 $pl = $u_p_files.length > 1
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
624 puts " Unexpected passes were found in the following #{pl "file"}:"
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
625 $u_p_files.each do |pass|
626 puts " #{pass}"
627 end
628 end
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
629 $pl = $nok > 1
630 puts " #{$nok} #{pl "test"} failed, #{$expected_failures} of which were expected."
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
631 unless $unexpected_failures.empty?
632 $unexpected_failures.uniq!
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
633 $pl = $unexpected_failures.size > 1
634 puts " Unexpected #{pl "failure"} #{were} found in the following #{pl "file"}:"
71e0e5e Ted Reed Make some additions to the statistics reported by the test harness.
treed authored
635 $unexpected_failures.each do |fail|
636 puts " #{fail}"
637 end
638 end
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
639 $pl = $missing_files.size > 1
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
640 unless $missing_files.empty?
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
641 puts " There #{were} #{$missing} test #{pl "file"} that reported fewer results than were planned:"
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
642 $missing_files.uniq!
643 $missing_files.each do |missing|
644 puts " #{missing}"
645 end
646 end
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
647 $pl = $toomany_files.size > 1
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
648 unless $toomany_files.empty?
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
649 puts " There #{were} #{$toomany} test #{pl "file"} that reported more results than were planned:"
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
650 $toomany_files.uniq!
651 $toomany_files.each do |toomany|
652 puts " #{toomany}"
653 end
654 end
fd55266 Ted Reed Add support for pluralization in the test suite messages.
treed authored
655 $pl = $unknown > 1
656 puts " There #{were} #{$unknown} unknown or confusing #{pl "result"}." if $unknown > 0
657 $pl = $failures > 1
658 puts " There #{were} #{$failures} complete #{pl "failure"}." if $failures > 0
be5f3c4 Ted Reed Make the test harness watch for "See issue" messages and report how many...
treed authored
659 $pl = $issue_lacks.size > 1
660 unless $i_l_files.empty?
661 puts " There #{were} #{$issue_lacks} #{pl "test"} that used todo or skip without noting an issue number, found in:"
662 $i_l_files.uniq!
663 $i_l_files.each do |file|
664 puts " #{file}"
665 end
666 end
8d2377f Ted Reed Fix the Rakefile so that test suites will still complete if individual f...
treed authored
667 $pl = $comp_fails > 1
668 unless $c_f_files.empty?
669 puts " There #{were} #{$comp_fails} #{pl "file"} that completely failed to compile:"
670 $c_f_files.uniq!
671 $c_f_files.each do |file|
672 puts " #{file}"
673 end
674 end
2c093da Ted Reed Add more items to the test suite report, and also to the CLEAN FOR COMMI...
treed authored
675 puts " -- CLEAN FOR COMMIT --" if clean?
c757e57 Ted Reed Add overall statistics to the test:all rake target.
treed authored
676 end
db841ed Ted Reed Move the issue stats report to a separate target: test:stats, which depe...
treed authored
677
66a059a Ted Reed Miscellaneous changes/fixes to the Rakefile.
treed authored
678 desc "Run test:all *and* produce stats about known issues."
db841ed Ted Reed Move the issue stats report to a separate target: test:stats, which depe...
treed authored
679 task :stats => [:all] do
680 $pl = $issue_counts.size > 1
681 unless $issue_counts.empty?
682 puts " The following #{are} the #{pl "issue"} currently known to affect the tests, and a count of the fails associated with #{them}:"
683 $issue_counts.each do |issue, count|
684 $pl = count > 1
685 puts " Issue ##{issue}: #{count} #{pl "fail"}"
686 end
687 else
688 puts " There are no issues currently known to affect the tests."
689 end
690 end
38f6a07 Ted Reed Add new build system.
treed authored
691 end
Something went wrong with that request. Please try again.