ruby-changes:73763
From: Nobuyoshi <ko1@a...>
Date: Wed, 28 Sep 2022 23:19:22 +0900 (JST)
Subject: [ruby-changes:73763] fc54dbe8b4 (master): bootstraptest/runner: fold dots by window size
https://git.ruby-lang.org/ruby.git/commit/?id=fc54dbe8b4 From fc54dbe8b40d131c72e9216b5ec2b50ae7fb5107 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 28 Sep 2022 21:39:25 +0900 Subject: bootstraptest/runner: fold dots by window size --- bootstraptest/runner.rb | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 9699b10bc0..f88fa1b102 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -73,9 +73,32 @@ BT = Struct.new(:ruby, https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L73 :failed, :reset, :columns, + :window_width, :width, :platform, - ).new + ) do + def putc(c) + unless self.quiet + if self.window_width == nil + if BT.tty + unless w = ENV["COLUMNS"] and (w = w.to_i) > 0 + w = 80 + end + w -= 1 + else + w = false + end + self.window_width = w + end + if self.window_width and self.columns >= self.window_width + $stderr.puts + self.columns = 0 + end + $stderr.print c + self.columns += 1 + end + end +end.new BT_STATE = Struct.new(:count, :error).new @@ -240,7 +263,7 @@ def concurrent_exec_test https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L263 end end - $stderr.print ' ' unless BT.quiet + BT.putc ' ' aq.close i = 1 term_wn = 0 @@ -252,7 +275,7 @@ def concurrent_exec_test https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L275 when BT.tty $stderr.print "#{BT.progress_bs}#{BT.progress[(i+=1) % BT.progress.size]}" else - $stderr.print '.' + BT.putc '.' end else term_wn += 1 @@ -427,7 +450,7 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc) https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L450 elsif BT.verbose $stderr.printf(". %.3f\n", t) else - $stderr.print '.' + BT.putc '.' end else $stderr.print "#{BT.failed}F" -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/