summaryrefslogtreecommitdiff
path: root/bootstraptest/runner.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2022-01-21 17:38:11 +0900
committerKoichi Sasada <ko1@atdot.net>2022-01-21 17:38:11 +0900
commit5e3a32021849718ae483eaaa9fbf155f91828039 (patch)
tree41c462e442baa1a48fb1dcc6c8af7b44b9c93d83 /bootstraptest/runner.rb
parenta15c50d6a123b1b16d7f76847102c66797b4066e (diff)
respect `--quiet` option for btest
Do not print anymore except errors.
Diffstat (limited to 'bootstraptest/runner.rb')
-rwxr-xr-xbootstraptest/runner.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index b155db18aa..acc113b729 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -187,8 +187,10 @@ def exec_test(pathes)
@width = pathes.map {|path| File.basename(path).size}.max + 2
pathes.each do |path|
@basename = File.basename(path)
- $stderr.printf("%s%-*s ", erase(@quiet), @width, @basename)
- $stderr.flush
+ unless @quiet
+ $stderr.printf("%s%-*s ", erase(@quiet), @width, @basename)
+ $stderr.flush
+ end
@columns = @width + 1
$stderr.puts if @verbose
count = @count
@@ -198,14 +200,14 @@ def exec_test(pathes)
if @error == error
msg = "PASS #{@count-count}"
@columns += msg.size - 1
- $stderr.print "#{@progress_bs}#{@passed}#{msg}#{@reset}"
+ $stderr.print "#{@progress_bs}#{@passed}#{msg}#{@reset}" unless @quiet
else
msg = "FAIL #{@error-error}/#{@count-count}"
$stderr.print "#{@progress_bs}#{@failed}#{msg}#{@reset}"
@columns = 0
end
end
- $stderr.puts unless @quiet and @tty and @error == error
+ $stderr.puts if !@quiet and (@tty or @error == error)
end
$stderr.print(erase) if @quiet
@errbuf.each do |msg|
@@ -213,9 +215,13 @@ def exec_test(pathes)
end
if @error == 0
if @count == 0
- $stderr.puts "No tests, no problem"
+ $stderr.puts "No tests, no problem" unless @quiet
else
- $stderr.puts "#{@passed}PASS#{@reset} all #{@count} tests"
+ if @quiet
+ $stdout.puts "#{@passed}PASS#{@reset} all #{@count} tests"
+ else
+ $stderr.puts "#{@passed}PASS#{@reset} all #{@count} tests"
+ end
end
exit true
else
@@ -225,7 +231,9 @@ def exec_test(pathes)
end
def show_progress(message = '')
- if @verbose
+ if @quiet
+ # do nothing
+ elsif @verbose
$stderr.print "\##{@count} #{@location} "
elsif @tty
$stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
@@ -234,7 +242,9 @@ def show_progress(message = '')
faildesc, errout = with_stderr {yield}
t = Time.now - t if @verbose
if !faildesc
- if @tty
+ if @quiet
+ # do nothing
+ elsif @tty
$stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
elsif @verbose
$stderr.printf(". %.3f\n", t)