Remove testall, unecessary
Tests are now executed via rake
Antonio Terceiro
5 years ago
0 | #!/usr/bin/ruby -- # -*- ruby -*- | |
1 | ||
2 | require 'runit/testsuite' | |
3 | require 'runit/cui/testrunner' | |
4 | require 'getoptlong' | |
5 | ||
6 | $:.unshift("../lib") | |
7 | ||
8 | opts = GetoptLong.new( | |
9 | ['--output', '-o', GetoptLong::REQUIRED_ARGUMENT], | |
10 | ['--quiet', '-q', GetoptLong::NO_ARGUMENT], | |
11 | ['--help', '-h', GetoptLong::NO_ARGUMENT]) | |
12 | ||
13 | outfile = '-' | |
14 | opts.each {|opt, val| | |
15 | case opt | |
16 | when "--output" then $stdout = open(val, "w"); outfile = val | |
17 | when "--quiet" then RUNIT::CUI::TestRunner.quiet_mode = true | |
18 | when "--help" then | |
19 | $stderr.puts "usage: #{$0} [-o file] [-q] [-h]" | |
20 | exit 1 | |
21 | end | |
22 | } | |
23 | ||
24 | Dir["test*.rb"].each {|t| | |
25 | next if t == __FILE__ | |
26 | require t | |
27 | } | |
28 | ||
29 | suite = RUNIT::TestSuite.new | |
30 | ObjectSpace.each_object(Class) {|klass| | |
31 | if klass.ancestors.include?(RUNIT::TestCase) | |
32 | suite.add_test(klass.suite) | |
33 | end | |
34 | } | |
35 | RUNIT::CUI::TestRunner.run(suite) | |
36 | if outfile != '-' | |
37 | $stdout.close | |
38 | IO.readlines(outfile).each {|line| | |
39 | line.chomp! | |
40 | if /^Errors:/ =~ line | |
41 | $stderr.puts "#{line}: See more detail in #{outfile}" | |
42 | elsif /^Failures:/ =~ line | |
43 | $stderr.puts "#{line}: See more detail in #{outfile}" | |
44 | elsif /^OK/ =~ line | |
45 | $stderr.puts "#{line}" | |
46 | end | |
47 | } | |
48 | end | |
49 |