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

Commit 1c31fc4

Browse files
benoittgtJonRowe
authored andcommitted
Avoid bisect command to get stuck (#2669)
Avoid bisect command to get stuck
1 parent b91a276 commit 1c31fc4

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

lib/rspec/core/bisect/fork_runner.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ def initialize(runner, channel)
9191
end
9292

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

9899
private

spec/integration/bisect_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,15 @@ def bisect(cli_args, expected_status=nil)
3232
expect(output).to include("Bisect failed!", "The example ordering is inconsistent")
3333
end
3434
end
35+
36+
context "when the bisect commasaturingnd is long" do
37+
# On OSX and Linux a file descriptor limit meant that the bisect process got stuck at a certain limit.
38+
# This test demonstrates that we can run large bisects above this limit (found to be at time of commit).
39+
# See: https://github.com/rspec/rspec-core/pull/2669
40+
it 'does not hit pipe size limit and does not get stuck' do
41+
output = bisect(%W[spec/rspec/core/resources/blocking_pipe_bisect_spec.rb_], 1)
42+
expect(output).to include("No failures found.")
43+
end
44+
end
3545
end
3646
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Deliberately named *.rb_ to avoid being loaded except when specified
2+
3+
RSpec.describe "1000 tests" do
4+
puts "Try to saturate the pipe in Bisect command"
5+
(0..1000).each do |t|
6+
it { expect(t).to eq t }
7+
end
8+
end

0 commit comments

Comments
 (0)