diff --git a/tests/run.rb b/tests/run.rb index 42506cf5f..48d274e7c 100755 --- a/tests/run.rb +++ b/tests/run.rb @@ -50,6 +50,8 @@ def main controller.test_date_after = Time.local($1, $2, $3, $4, $5, $6) elsif (arg =~ /-D([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})/) controller.test_date_before = Time.local($1, $2, $3, $4, $5, $6) + elsif ((arg == "-s") or (arg == "--show-duration")) + controller.show_duration = true elsif arg =~ /-j(\d+)/ controller.num_threads = $1.to_i elsif /^ (!)? (\d{1,4}) (?: - (\d{1,4}) )?$/x.match arg @@ -74,6 +76,7 @@ Syntax: run.rb [options] -DDATE only run tests added before DATE (YYYYMMDD-HHMM) -u, --update-failed update the results for tests that fail -r, --record-duration update the duration field of the tests run + -s, --show-duration show how long each test took to run -jNUM run NUM tests at once (default: number of CPU cores) 123 run test 123 (any number; can be given multiple times) 12-345 run tests 12 through 345 (any range of numbers; can be given multiple times) diff --git a/tests/test.d/controller.rb b/tests/test.d/controller.rb index 86ad35360..14fcec284 100644 --- a/tests/test.d/controller.rb +++ b/tests/test.d/controller.rb @@ -1,5 +1,5 @@ class Controller - attr_accessor :test_failed, :test_new, :test_date_after, :teset_date_before, :update_failed, :num_failed, :record_duration + attr_accessor :test_failed, :test_new, :test_date_after, :teset_date_before, :update_failed, :num_failed, :record_duration, :show_duration attr_reader :num_threads, :results def initialize @@ -11,6 +11,7 @@ class Controller @update_failed = false @num_threads = self.get_num_processors @record_duration = false + @show_duration = false @tests = Array.new @exclusions = Array.new @@ -128,6 +129,8 @@ class Controller result = current_test.run_test expected_results duration = Time.now - start + puts "Finished '#{class_name}' after #{sprintf('%0.3f', duration)}s" if self.show_duration + if (result) if (!@results.exist? class_name) self.add_result class_name, :passed, :message => " NEW test. Storing result '#{result}'.", :checksum => result, :duration => duration