ext/revdispatch/test.rb in evdispatch-0.1.4 vs ext/revdispatch/test.rb in evdispatch-0.1.5
- old
+ new
@@ -1,11 +1,12 @@
require 'revdispatch'
# to run this through valgrind run the server outside of this script
# i run this: valgrind --leak-check=full ~/project/ruby-valgrind-env/bin/ruby test.rb r
pid = nil
-unless ARGV[0] == 'r'
+running_ebb_here = (ARGV[0] != 'r' and !`uname`.grep(/darwin/i))
+if running_ebb_here
pid = fork do
require 'server'
start_test_server
end
end
@@ -76,11 +77,11 @@
# sometime later you can stop the event loop
d.stop
end
begin
- sleep 1 unless ARGV[0] == 'r'
+ sleep 1 if running_ebb_here
ObjectSpace.garbage_collect
count = ObjectSpace.each_object { }
puts "Starting Total objects: #{count}"
@@ -90,14 +91,14 @@
rescue => e
puts e.message, e.backtrace
end
- Process.kill('HUP', pid) unless ARGV[0] == 'r'
count = ObjectSpace.each_object { }
puts "Final Total objects: #{count}"
count = nil
ObjectSpace.garbage_collect
end
count = ObjectSpace.each_object { }
puts "After garbage collection objects: #{count}"
+Process.kill('HUP', pid) if running_ebb_here