public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Search Repo:
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Add beginning of unit test suite for OXT.
Hongli Lai (Phusion) (author)
Thu Jun 19 05:04:08 -0700 2008
commit  2b185c69166b85dad6ccf3eb587376693a4a9bd5
tree    413632bcdbf4491b4b10f5f38d7dfa2f60908b17
parent  c1ba402649c1b59a0b1b450897df070dbf1daf19
...
53
54
55
 
56
57
58
...
195
196
197
198
199
200
 
 
 
201
202
203
...
224
225
226
 
 
 
 
 
 
227
228
229
230
231
 
 
 
 
 
 
232
233
234
...
265
266
267
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
269
270
...
298
299
300
301
 
302
303
304
...
437
438
439
 
440
441
442
...
53
54
55
56
57
58
59
...
196
197
198
 
 
 
199
200
201
202
203
204
...
225
226
227
228
229
230
231
232
233
234
235
236
237
 
238
239
240
241
242
243
244
245
246
...
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
...
330
331
332
 
333
334
335
336
...
469
470
471
472
473
474
475
0
@@ -53,6 +53,7 @@ desc "Build everything"
0
 task :default => [
0
   :native_support,
0
   :apache2,
0
+ 'test/oxt/oxt_test_main',
0
   'test/Apache2ModuleTests',
0
   'benchmark/DummyRequestHandler'
0
 ]
0
@@ -195,9 +196,9 @@ end
0
 ##### Unit tests
0
 
0
 class TEST
0
- CXXFLAGS = ::CXXFLAGS + " -Isupport -DTESTING_SPAWN_MANAGER -DTESTING_APPLICATION_POOL "
0
- AP2_FLAGS = "-I../ext/apache2 -I../ext #{APR_FLAGS}"
0
-
0
+ CXXFLAGS = "#{::CXXFLAGS} -DTESTING_SPAWN_MANAGER -DTESTING_APPLICATION_POOL "
0
+
0
+ AP2_FLAGS = "-I../ext/apache2 -I../ext -Isupport #{APR_FLAGS}"
0
   AP2_OBJECTS = {
0
     'CxxTestMain.o' => %w(CxxTestMain.cpp),
0
     'MessageChannelTest.o' => %w(MessageChannelTest.cpp
0
@@ -224,11 +225,22 @@ class TEST
0
       ../ext/apache2/Application.h),
0
     'UtilsTest.o' => %w(UtilsTest.cpp ../ext/apache2/Utils.h)
0
   }
0
+
0
+ OXT_FLAGS = "-I../../ext -I../support"
0
+ OXT_OBJECTS = {
0
+ 'oxt_test_main.o' => %w(oxt_test_main.cpp),
0
+ 'backtrace_test.o' => %w(backtrace_test.cpp)
0
+ }
0
 end
0
 
0
 subdir 'test' do
0
   desc "Run all unit tests (but not integration tests)"
0
- task :test => [:'test:apache2', :'test:ruby', :'test:integration']
0
+ task :test => [:'test:oxt', :'test:apache2', :'test:ruby', :'test:integration']
0
+
0
+ desc "Run unit tests for the OXT library"
0
+ task 'test:oxt' => 'oxt/oxt_test_main' do
0
+ sh "./oxt/oxt_test_main"
0
+ end
0
   
0
   desc "Run unit tests for the Apache 2 module"
0
   task 'test:apache2' => [
0
@@ -265,6 +277,26 @@ subdir 'test' do
0
   task 'test:integration' => [:apache2, :native_support] do
0
     sh "spec -c -f s integration_tests.rb"
0
   end
0
+
0
+ file 'oxt/oxt_test_main' => TEST::OXT_OBJECTS.keys.map{ |x| "oxt/#{x}" } +
0
+ ['../ext/libboost_oxt.a'] do
0
+ Dir.chdir('oxt') do
0
+ objects = TEST::OXT_OBJECTS.keys.join(' ')
0
+ create_executable "oxt_test_main", objects,
0
+ "#{LDFLAGS} #{MULTI_ARCH_FLAGS} " <<
0
+ "../../ext/libboost_oxt.a " <<
0
+ "-lpthread"
0
+ end
0
+ end
0
+
0
+ TEST::OXT_OBJECTS.each_pair do |target, sources|
0
+ file "oxt/#{target}" => sources.map{ |x| "oxt/#{x}" } do
0
+ Dir.chdir('oxt') do
0
+ puts "### In test/oxt:"
0
+ compile_cxx sources[0], "#{TEST::OXT_FLAGS} #{TEST::CXXFLAGS}"
0
+ end
0
+ end
0
+ end
0
 
0
   file 'Apache2ModuleTests' => TEST::AP2_OBJECTS.keys +
0
    ['../ext/libboost_oxt.a',
0
@@ -298,7 +330,7 @@ subdir 'test' do
0
   end
0
   
0
   task :clean do
0
- sh "rm -f Apache2ModuleTests *.o"
0
+ sh "rm -f oxt/oxt_test_main oxt/*.o Apache2ModuleTests *.o"
0
   end
0
 end
0
 
0
@@ -437,6 +469,7 @@ spec = Gem::Specification.new do |s|
0
     'misc/*',
0
     'test/*.{rb,cpp,example}',
0
     'test/support/*',
0
+ 'test/oxt/*.cpp',
0
     'test/ruby/*',
0
     'test/ruby/*/*',
0
     'test/stub/*',

Comments

    No one has commented yet.