spec/support/loose_threads.rb in celluloid-0.18.0.pre vs spec/support/loose_threads.rb in celluloid-0.18.0.pre2
- old
+ new
@@ -11,24 +11,11 @@
next if /Fiber/ =~ name
next unless /^Ruby-/ =~ name
backtrace = thread.backtrace # avoid race maybe
next unless backtrace
next if backtrace.empty? # possibly a timer thread
- end
-
- if RUBY_ENGINE == "rbx"
- # Avoid disrupting Rubinious thread
- next if thread.backtrace.first =~ %r{rubysl/timeout/timeout\.rb}
-
- if Specs::ALLOW_SLOW_MAILBOXES
- if thread.backtrace.first =~ /wait/
- next if thread.backtrace[1] =~ /mailbox\.rb/ && thread.backtrace[1] =~ /check/
- end
- end
- end
-
- if RUBY_ENGINE == "ruby"
+ else
# Sometimes stays
next if thread.backtrace.nil?
next unless thread.backtrace.is_a?(Array)
next if thread.backtrace.empty?
next if thread.backtrace.first =~ /timeout\.rb/
@@ -37,11 +24,11 @@
thread
end.compact
end
def thread_name(thread)
- (RUBY_PLATFORM == "java") ? thread.to_java.getNativeThread.get_name : ""
+ RUBY_PLATFORM == "java" ? thread.to_java.getNativeThread.get_name : ""
end
def assert_no_loose_threads!(location)
loose = Specs.loose_threads
backtraces = loose.map do |thread|
@@ -59,10 +46,10 @@
STDERR.puts "Sleeping so you can investigate on the Java side...."
sleep
end
- fail Celluloid::ThreadLeak, "Aborted due to runaway threads (#{location})\n"\
+ raise Celluloid::ThreadLeak, "Aborted due to runaway threads (#{location})\n"\
"List: (#{loose.map(&:inspect)})\n:#{backtraces.join("\n")}"
end
end
end