Skip to content

Commit

Permalink
[core] Avoid bisect command to get stuck (rspec/rspec-core#2669)
Browse files Browse the repository at this point in the history
Avoid bisect command to get stuck

---
This commit was imported from rspec/rspec-core@1c31fc4.
  • Loading branch information
benoittgt authored and JonRowe committed Dec 28, 2019
1 parent c91b197 commit ed95a61
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rspec-core/lib/rspec/core/bisect/fork_runner.rb
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 rspec-core/spec/integration/bisect_spec.rb
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
@@ -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

0 comments on commit ed95a61

Please sign in to comment.