null+****@clear*****
null+****@clear*****
2012年 8月 8日 (水) 15:18:48 JST
Kouhei Sutou 2012-08-08 15:18:48 +0900 (Wed, 08 Aug 2012) New Revision: cccac5b00f2cccca47cdefa24bcbbfa13ee79e2d https://github.com/groonga/grntest/commit/cccac5b00f2cccca47cdefa24bcbbfa13ee79e2d Log: Measure elapsed time for running all tests Modified files: lib/groonga/tester.rb Modified: lib/groonga/tester.rb (+19 -13) =================================================================== --- lib/groonga/tester.rb 2012-08-08 15:18:29 +0900 (9633137) +++ lib/groonga/tester.rb 2012-08-08 15:18:48 +0900 (330d558) @@ -235,6 +235,9 @@ module Groonga end end + class TestSuitesResult < Result + end + class TestSuitesRunner def initialize(tester) @tester = tester @@ -255,19 +258,22 @@ module Groonga def run(test_suites) succeeded = true reporter = create_reporter - reporter.start - catch do |tag| - test_suites.each do |suite_name, test_script_paths| - reporter.start_suite(suite_name) - test_script_paths.each do |test_script_path| - runner = TestRunner.new(@tester, test_script_path) - succeeded = false unless runner.run(reporter) - throw(tag) if runner.interrupted? + result = TestSuitesResult.new + result.measure do + reporter.start + catch do |tag| + test_suites.each do |suite_name, test_script_paths| + reporter.start_suite(suite_name) + test_script_paths.each do |test_script_path| + runner = TestRunner.new(@tester, test_script_path) + succeeded = false unless runner.run(reporter) + throw(tag) if runner.interrupted? + end + reporter.finish_suite(suite_name) end - reporter.finish_suite(suite_name) end end - reporter.finish + reporter.finish(result) succeeded end end @@ -1127,7 +1133,7 @@ EOF def finish_suite(suite_name) end - def finish + def finish(result) puts puts("#{@n_tests} tests, " + "#{@n_passed_tests} passes, " + @@ -1138,7 +1144,7 @@ EOF else pass_ratio = (@n_passed_tests / @n_tests.to_f) * 100 end - puts("%.4g%% passed." % pass_ratio) + puts("%.4g%% passed in %.4fs." % [pass_ratio, result.elapsed_time]) end private @@ -1198,7 +1204,7 @@ EOF clear_line end - def finish + def finish(result) n_using_lines.times do puts end -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B... 下載