Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore calls in other threads when counting ruby calls for a test #114

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/unit/context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ def test_evaluating_a_variable_entirely_within_c
called_ruby_method_count = 0
called_c_method_count = 0

test_thread = Thread.current
begin
call_trace = TracePoint.trace(:call) do |t|
unless t.self == TracePoint || t.self.is_a?(TracePoint)
unless t.self == TracePoint || t.self.is_a?(TracePoint) || Thread.current != test_thread
called_ruby_method_count += 1
end
end

c_call_trace = TracePoint.trace(:c_call) do |t|
unless t.self == TracePoint || t.self.is_a?(TracePoint)
unless t.self == TracePoint || t.self.is_a?(TracePoint) || Thread.current != test_thread
called_c_method_count += 1
end
end
Expand Down