Merge branch 'feature/MSP-11147/thread-leak-detection' into feature/MSP-11605/lazy-thread-creation
MSP-11605bug/bundler_fix
commit
55aa32c6b6
|
@ -31,7 +31,7 @@ module Metasploit
|
|||
unless @configured
|
||||
RSpec.configure do |config|
|
||||
config.before(:suite) do
|
||||
thread_count = Thread.list.count
|
||||
thread_count = Metasploit::Framework::Spec::Threads::Suite.non_debugger_thread_list.count
|
||||
|
||||
# check with if first so that error message can be constructed lazily
|
||||
if thread_count > EXPECTED_THREAD_COUNT_AROUND_SUITE
|
||||
|
@ -68,7 +68,7 @@ module Metasploit
|
|||
f.puts 'after(:suite)'
|
||||
end
|
||||
|
||||
thread_list = Thread.list
|
||||
thread_list = Metasploit::Framework::Spec::Threads::Suite.non_debugger_thread_list
|
||||
|
||||
thread_uuids = thread_list.map { |thread|
|
||||
thread[Metasploit::Framework::Spec::Threads::Suite::UUID_THREAD_LOCAL_VARIABLE]
|
||||
|
@ -118,7 +118,8 @@ module Metasploit
|
|||
threads_logger_pathname = parent_pathname.join('logger')
|
||||
load_pathname = parent_pathname.parent.parent.parent.parent.expand_path
|
||||
|
||||
ENV['RUBYOPT'] = "-I#{load_pathname} -r#{threads_logger_pathname} #{ENV['RUBYOPT']}"
|
||||
# Must append to RUBYOPT or Rubymine debugger will not work
|
||||
ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -I#{load_pathname} -r#{threads_logger_pathname}"
|
||||
end
|
||||
|
||||
Rake::Task.define_task(spec: 'metasploit:framework:spec:threads:suite')
|
||||
|
@ -194,6 +195,15 @@ module Metasploit
|
|||
|
||||
lines_by_thread_uuid
|
||||
end
|
||||
|
||||
# @return
|
||||
def self.non_debugger_thread_list
|
||||
Thread.list.reject { |thread|
|
||||
# don't do `is_a? Debugger::DebugThread` because it requires Debugger::DebugThread to be loaded, which it
|
||||
# won't when not debugging.
|
||||
thread.class.name == 'Debugger::DebugThread'
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue