Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Avoid bisect command to get stuck #2669

Merged
merged 1 commit into from
Dec 14, 2019
Merged
Show file tree
Hide file tree
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 lib/rspec/core/bisect/fork_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ def initialize(runner, channel)
end

def dispatch_specs(run_descriptor)
pid = fork { run_specs(run_descriptor) }
Process.waitpid(pid)
fork { run_specs(run_descriptor) }
# We don't use Process.waitpid here as it was causing bisects to
# block due to the file descriptor limit on OSX / Linux.
end

private
Expand Down
10 changes: 10 additions & 0 deletions spec/integration/bisect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,15 @@ def bisect(cli_args, expected_status=nil)
expect(output).to include("Bisect failed!", "The example ordering is inconsistent")
end
end

context "when the bisect commasaturingnd is long" do
# On OSX and Linux a file descriptor limit meant that the bisect process got stuck at a certain limit.
# This test demonstrates that we can run large bisects above this limit (found to be at time of commit).
# See: https://github.com/rspec/rspec-core/pull/2669
it 'does not hit pipe size limit and does not get stuck' do
output = bisect(%W[spec/rspec/core/resources/blocking_pipe_bisect_spec.rb_], 1)
expect(output).to include("No failures found.")
end
end
end
end
8 changes: 8 additions & 0 deletions spec/rspec/core/resources/blocking_pipe_bisect_spec.rb_
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Deliberately named *.rb_ to avoid being loaded except when specified

RSpec.describe "1000 tests" do
puts "Try to saturate the pipe in Bisect command"
(0..1000).each do |t|
it { expect(t).to eq t }
end
end