[test] Remove default for zero test cases.
authormachenbach <machenbach@chromium.org>
Wed, 27 May 2015 13:50:43 +0000 (06:50 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 27 May 2015 13:50:48 +0000 (13:50 +0000)
BUG=

Review URL: https://codereview.chromium.org/1153103003

Cr-Commit-Position: refs/heads/master@{#28654}

tools/run-tests.py
tools/testrunner/local/progress.py

index e8a9598..78a7edc 100755 (executable)
@@ -612,10 +612,6 @@ def Execute(arch, mode, args, options, suites, workspace):
   if options.report:
     verbose.PrintReport(all_tests)
 
-  if num_tests == 0:
-    print "No tests to run."
-    return 0
-
   # Run the tests, either locally or distributed on the network.
   start_time = time.time()
   progress_indicator = progress.PROGRESS_INDICATORS[options.progress]()
index e40872f..19d39f7 100644 (file)
@@ -200,10 +200,12 @@ class CompactProgressIndicator(ProgressIndicator):
   def PrintProgress(self, name):
     self.ClearLine(self.last_status_length)
     elapsed = time.time() - self.start_time
+    progress = 0 if not self.runner.total else (
+        ((self.runner.total - self.runner.remaining) * 100) //
+          self.runner.total)
     status = self.templates['status_line'] % {
       'passed': self.runner.succeeded,
-      'remaining': (((self.runner.total - self.runner.remaining) * 100) //
-                    self.runner.total),
+      'progress': progress,
       'failed': len(self.runner.failed),
       'test': name,
       'mins': int(elapsed) / 60,
@@ -220,7 +222,7 @@ class ColorProgressIndicator(CompactProgressIndicator):
   def __init__(self):
     templates = {
       'status_line': ("[%(mins)02i:%(secs)02i|"
-                      "\033[34m%%%(remaining) 4d\033[0m|"
+                      "\033[34m%%%(progress) 4d\033[0m|"
                       "\033[32m+%(passed) 4d\033[0m|"
                       "\033[31m-%(failed) 4d\033[0m]: %(test)s"),
       'stdout': "\033[1m%s\033[0m",
@@ -236,7 +238,7 @@ class MonochromeProgressIndicator(CompactProgressIndicator):
 
   def __init__(self):
     templates = {
-      'status_line': ("[%(mins)02i:%(secs)02i|%%%(remaining) 4d|"
+      'status_line': ("[%(mins)02i:%(secs)02i|%%%(progress) 4d|"
                       "+%(passed) 4d|-%(failed) 4d]: %(test)s"),
       'stdout': '%s',
       'stderr': '%s',