summaryrefslogtreecommitdiff
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
parenta15c50d6a123b1b16d7f76847102c66797b4066e (diff)
respect `--quiet` option for btest
Do not print anymore except errors.
-rwxr-xr-xbootstraptest/runner.rb26
-rw-r--r--bootstraptest/test_fiber.rb2
2 files changed, 19 insertions, 9 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)
diff --git a/bootstraptest/test_fiber.rb b/bootstraptest/test_fiber.rb
index 2614dd13bf..f651050b96 100644
--- a/bootstraptest/test_fiber.rb
+++ b/bootstraptest/test_fiber.rb
@@ -10,7 +10,7 @@ show_limit %q{
puts "Fiber count: #{fibers.count} (#{error})"
break
end while true
-}
+} unless @quiet
assert_equal %q{ok}, %q{
Fiber.new{