summaryrefslogtreecommitdiff
path: root/bootstraptest/runner.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-29 11:46:54 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-29 14:09:25 +0900
commit942066713b736c2554f25513ae7986f04e929820 (patch)
tree149c7c90c8765ab87da5268411798674f2c351b7 /bootstraptest/runner.rb
parent5a8aaedaff48fbf715eed67f29282f9464f118f0 (diff)
bootstraptest/runner: run in parallel if in parallel build
Diffstat (limited to 'bootstraptest/runner.rb')
-rwxr-xr-xbootstraptest/runner.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 9eeec8113d..e7f4fb69fb 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -101,8 +101,7 @@ BT = Class.new(bt) do
end
def wn=(wn)
- if wn <= 0
- wn = nil
+ unless wn == 1
if /(?:\A|\s)--jobserver-(?:auth|fds)=\K(\d+),(\d+)/ =~ ENV.delete("MAKEFLAGS")
begin
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
@@ -112,7 +111,7 @@ BT = Class.new(bt) do
else
r.close_on_exec = true
w.close_on_exec = true
- tokens = r.read_nonblock(1024, exception: false)
+ tokens = r.read_nonblock(wn > 0 ? wn : 1024, exception: false)
r.close
if String === tokens
tokens.freeze
@@ -126,7 +125,7 @@ BT = Class.new(bt) do
end
end
end
- unless wn
+ if wn <= 0
require 'etc'
wn = [Etc.nprocessors / 2, 1].max
end
@@ -145,7 +144,7 @@ def main
BT.color = nil
BT.tty = nil
BT.quiet = false
- BT.wn = 1
+ # BT.wn = 1
dir = nil
quiet = false
tests = nil
@@ -216,6 +215,7 @@ End
BT.progress = %w[- \\ | /]
BT.progress_bs = "\b" * BT.progress[0].size
BT.tty = $stderr.tty? if BT.tty.nil?
+ BT.wn ||= /-j(\d+)?/ =~ (ENV["MAKEFLAGS"] || ENV["MFLAGS"]) ? $1.to_i : 1
case BT.color
when nil