diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-10 14:11:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-10 14:11:57 +0000 |
commit | 2c9c6271e84a4806c21728a97a2e6022798e1a11 (patch) | |
tree | 56f562059a0a65f0f6edc12358c8f75c19a066e2 /bootstraptest | |
parent | 26848ef8ff179b2dc2aae08fc859659e276126ae (diff) |
bootstraptest/runner.rb: refine output
* bootstraptest/runner.rb (exec_test, show_progress): erase with
white spaces, and adjust each results at same column.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rwxr-xr-x | bootstraptest/runner.rb | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index e7b7f55a15..71c8f5393e 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -140,9 +140,8 @@ End @passed = "\e[#{colors["pass"] || "32"}m" @failed = "\e[#{colors["fail"] || "31"}m" @reset = "\e[m" - @erase = "\r\e[2K\r" else - @passed = @failed = @reset = @erase = "" + @passed = @failed = @reset = "" end unless quiet puts Time.now @@ -163,28 +162,44 @@ End } end +def erase(e = true) + if e and @columns > 0 + "\r#{" "*@columns}\r" + else + "" + end +end + def exec_test(pathes) @count = 0 @error = 0 @errbuf = [] @location = nil + @columns = 0 + @width = pathes.map {|path| File.basename(path).size}.max + 2 pathes.each do |path| @basename = File.basename(path) - $stderr.print @basename, " " + $stderr.printf("%s%-*s ", erase(@quiet), @width, @basename) + $stderr.flush + @columns = @width + 1 $stderr.puts if @verbose count = @count error = @error load File.expand_path(path) if @tty if @error == error - $stderr.print "#{@progress_bs}#{@passed}PASS #{@count-count}#{@reset}" - $stderr.print @erase if @quiet + msg = "PASS #{@count-count}" + @columns += msg.size - 1 + $stderr.print "#{@progress_bs}#{@passed}#{msg}#{@reset}" else - $stderr.print "#{@progress_bs}#{@failed}FAIL #{@error-error}/#{@count-count}#{@reset}" + msg = "FAIL #{@error-error}/#{@count-count}" + $stderr.print "#{@progress_bs}#{@failed}#{msg}#{@reset}" + @columns = 0 end end - $stderr.puts unless @quiet and @tty + $stderr.puts unless @quiet and @tty and @error == error end + $stderr.print(erase) if @quiet if @error == 0 if @count == 0 $stderr.puts "No tests, no problem" @@ -228,7 +243,7 @@ def show_progress(message = '') $stderr.print "#{@failed}stderr output is not empty#{@reset}\n", adjust_indent(errout) end if @tty and !@verbose - $stderr.print @basename, " ", @progress[@count % @progress.size] + $stderr.printf("%-*s%s", @width, @basename, @progress[@count % @progress.size]) end end rescue Interrupt @@ -450,7 +465,7 @@ end def error(msg, additional_message) msg = "#{@failed}\##{@count} #{@location}#{@reset}: #{msg} #{additional_message}" if @tty - $stderr.puts "#{@erase}#{msg}" + $stderr.puts "#{erase}#{msg}" else @errbuf.push msg end |