root/trunk/tasks/tests.rake

Revision 788, 4.2 kB (checked in by raggi, 8 months ago)

Merge of branches/raggi
Most notable work and patches by Aman Gupta, Roger Pack, and James Tucker.
Patches / Tickets also submitted by: Jeremy Evans, aanand, darix, mmmurf,
danielaquino, macournoyer.

  • Moved docs into docs/ dir
  • Major refactor of rakefile, added generic rakefile helpers in tasks
  • Added example CPP build rakefile in tasks/cpp.rake
  • Moved rake tests out to tasks/tests.rake
  • Added svn ignores where appropriate
  • Fixed jruby build on older java platforms
  • Gem now builds from Rakefile rather than directly via extconf
  • Gem unified for jruby, C++ and pure ruby.
  • Correction for pure C++ build, removing ruby dependency
  • Fix for CYGWIN builds on ipv6
  • Major refactor for extconf.rb
  • Working mingw builds
  • extconf optionally uses pkg_config over manual configuration
  • extconf builds for 1.9 on any system that has 1.9
  • extconf no longer links pthread explicitly
  • looks for kqueue on all *nix systems
  • better error output on std::runtime_error, now says where it came from
  • Fixed some tests on jruby
  • Added test for general send_data flaw, required for a bugfix in jruby build
  • Added timeout to epoll tests
  • Added fixes for java reactor ruby api
  • Small addition of some docs in httpclient.rb and httpcli2.rb
  • Some refactor and fixes in smtpserver.rb
  • Added parenthesis where possible to avoid excess ruby warnings
  • Refactor of $eventmachine_library logic for accuracy and maintenance, jruby
  • EM::start_server now supports unix sockets
  • EM::connect now supports unix sockets
  • EM::defer @threadqueue now handled more gracefully
  • Added better messages on exceptions raised
  • Fix edge case in timer fires
  • Explicitly require buftok.rb
  • Add protocols to autoload, rather than require them all immediately
  • Fix a bug in pr_eventmachine for outbound_q
  • Refactors to take some of the use of defer out of tests.
  • Fixes in EM.defer under start/stop conditions. Reduced scope of threads.
Line 
1 # This is used by several rake tasks, that parameterize the
2 # behavior so we can use the same tests to test both the
3 # extension and non-extension versions.
4 def run_tests t, libr = :cascade, test_files="test_*.rb"
5   require 'test/unit/testsuite'
6   require 'test/unit/ui/console/testrunner'
7   require 'tests/testem'
8  
9   base_dir = File.expand_path(File.dirname(__FILE__) + '/../') + '/'
10  
11   runner = Test::Unit::UI::Console::TestRunner
12  
13   $eventmachine_library = libr
14   EmTestRunner.run(test_files)
15  
16   suite = Test::Unit::TestSuite.new($name)
17
18   ObjectSpace.each_object(Class) do |testcase|
19     suite << testcase.suite if testcase < Test::Unit::TestCase
20   end
21
22   runner.run(suite)
23 end
24
25 desc "Run tests for #{Spec.name}."
26 task :test do |t|
27   # run_tests t
28   # Rake +/ friends leave threads, etc, less stable test runs.
29   ruby "-Ilib -Iext -Ijava tests/testem.rb #{'-v' if ENV['VERBOSE']}"
30 end
31
32 namespace :test do
33   desc "Run tests for #{Spec.name}."
34   task :partial do |t|
35     lib = RUBY_PLATFORM =~ /java/ ? :java : :extension
36     run_tests t, lib, [
37       "test_basic.rb",
38       "test_epoll.rb",
39       "test_errors.rb",
40       "test_eventables.rb",
41       "test_exc.rb",
42       "test_futures.rb",
43       "test_hc.rb",
44       "test_httpclient2.rb",
45       "test_httpclient.rb",
46       "test_kb.rb",
47       "test_ltp2.rb",
48       "test_ltp.rb",
49       "test_next_tick.rb",
50       "test_processes.rb",
51       "test_pure.rb",
52       "test_running.rb",
53       "test_sasl.rb",
54       #"test_send_file.rb",
55       "test_servers.rb",
56       "test_smtpclient.rb",
57       "test_smtpserver.rb",
58       "test_spawn.rb",
59       "test_timers.rb",
60       "test_ud.rb",
61     ].map { |tf| "tests/#{tf}" }
62   end
63  
64   desc "Run java tests for #$name."
65   task :testjava do |t|
66     run_tests t, :java
67   end
68
69   desc "Run pure-ruby tests for #$name."
70   task :testpr do |t|
71     run_tests t, :pure_ruby
72   end
73
74   desc "Run extension tests for #$name."
75   task :testext do |t|
76     run_tests t, :extension
77   end
78
79   desc "PROVISIONAL: run tests for user-defined events"
80   task :ud do |t|
81     run_tests t, :extension, "test_ud.rb"
82   end
83
84   desc "PROVISIONAL: run tests for line/text protocol handler"
85   task :ltp do |t|
86     run_tests t, :extension, "test_ltp*.rb"
87   end
88
89   desc "PROVISIONAL: run tests for header/content protocol handler"
90   task :hc do |t|
91     run_tests t, :extension, "test_hc.rb"
92   end
93
94   desc "PROVISIONAL: run tests for exceptions"
95   task :exc do |t|
96     run_tests t, :extension, "test_exc.rb"
97   end
98
99   desc "Test protocol handlers"
100   task :protocols => [ :hc, :ltp ]
101
102
103   desc "Test HTTP client"
104   task :httpclient do |t|
105     run_tests t, :extension, "test_httpclient.rb"
106   end
107
108   desc "Test HTTP client2"
109   task :httpclient2 do |t|
110     run_tests t, :extension, "test_httpclient2.rb"
111   end
112
113   desc "Test futures"
114   task :futures do |t|
115     run_tests t, :extension, "test_future*.rb"
116   end
117
118   desc "Test Timers"
119   task :timers do |t|
120     run_tests t, :extension, "test_timer*.rb"
121   end
122
123   desc "Test Next Tick"
124   task :next_tick do |t|
125     run_tests t, :extension, "test_next_tick*.rb"
126   end
127
128   desc "Test Epoll"
129   task :epoll do |t|
130     run_tests t, :extension, "test_epoll*.rb"
131   end
132
133   desc "Test Servers"
134   task :servers do |t|
135     run_tests t, :extension, "test_servers*.rb"
136   end
137
138   desc "Test Basic"
139   task :basic do |t|
140     run_tests t, :extension, "test_basic*.rb"
141   end
142
143   desc "Test Send File"
144   task :send_file do |t|
145     run_tests t, :extension, "test_send_file*.rb"
146   end
147
148   desc "Test Running"
149   task :running do |t|
150     run_tests t, :extension, "test_running*.rb"
151   end
152
153   desc "Test Keyboard Events"
154   task :keyboard do |t|
155     run_tests t, :extension, "test_kb*.rb"
156   end
157
158   desc "Test Spawn"
159   task :spawn do |t|
160     run_tests t, :extension, "test_spawn*.rb"
161   end
162
163   desc "Test SMTP"
164   task :smtp do |t|
165     run_tests t, :extension, "test_smtp*.rb"
166   end
167
168   desc "Test Errors"
169   task :errors do |t|
170     run_tests t, :extension, "test_errors*.rb"
171   end
172
173   desc "Test Pure Ruby"
174   task :pure do |t|
175     run_tests t, :extension, "test_pure*.rb"
176   end
177
178   desc "Test Processes"
179   task :processes do |t|
180     run_tests t, :extension, "test_process*.rb"
181   end
182
183   desc "Test SASL"
184   task :sasl do |t|
185     run_tests t, :java, "test_sasl*.rb"
186   end
187  
188   desc "Test Attach"
189   task :attach do |t|
190     run_tests t, :extension, "test_attach*.rb"
191   end
192 end
Note: See TracBrowser for help on using the browser.