From fc54dbe8b40d131c72e9216b5ec2b50ae7fb5107 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada 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(-) (limited to 'bootstraptest') 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, :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 end end - $stderr.print ' ' unless BT.quiet + BT.putc ' ' aq.close i = 1 term_wn = 0 @@ -252,7 +275,7 @@ def concurrent_exec_test 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) elsif BT.verbose $stderr.printf(". %.3f\n", t) else - $stderr.print '.' + BT.putc '.' end else $stderr.print "#{BT.failed}F" -- cgit v1.2.3