ruby-changes:73785
From: Nobuyoshi <ko1@a...>
Date: Thu, 29 Sep 2022 14:09:43 +0900 (JST)
Subject: [ruby-changes:73785] 942066713b (master): bootstraptest/runner: run in parallel if in parallel build
https://git.ruby-lang.org/ruby.git/commit/?id=942066713b From 942066713b736c2554f25513ae7986f04e929820 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 29 Sep 2022 11:46:54 +0900 Subject: bootstraptest/runner: run in parallel if in parallel build --- bootstraptest/runner.rb | 10 +++++----- 1 file 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 https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L101 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 https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L111 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 https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L125 end end end - unless wn + if wn <= 0 require 'etc' wn = [Etc.nprocessors / 2, 1].max end @@ -145,7 +144,7 @@ def main https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L144 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 https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L215 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/