Revert of [test] Refactoring - Let runner handle test IDs. (patchset #1 id:1 of https...
authormachenbach <machenbach@chromium.org>
Wed, 10 Jun 2015 06:46:35 +0000 (23:46 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 10 Jun 2015 06:46:45 +0000 (06:46 +0000)
Reason for revert:
[Sheriff] Revert until the tree is in a better state.

Original issue's description:
> [test] Refactoring - Let runner handle test IDs.
>
> This prepares for properly rerunning tests. Currently when
> tests are rerun, the same test object is reused. This
> will be changed in a follow up.
>
> Committed: https://crrev.com/f41a81b8a513fc360c500c066b74f223bc9c0223
> Cr-Commit-Position: refs/heads/master@{#28864}

TBR=jkummerow@chromium.org,tandrii@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

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

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

tools/run-tests.py
tools/testrunner/local/execution.py
tools/testrunner/network/network_execution.py

index 897f483..78a7edc 100755 (executable)
@@ -584,6 +584,7 @@ def Execute(arch, mode, args, options, suites, workspace):
   }
   all_tests = []
   num_tests = 0
+  test_id = 0
   for s in suites:
     s.ReadStatusFile(variables)
     s.ReadTestCases(ctx)
@@ -601,6 +602,9 @@ def Execute(arch, mode, args, options, suites, workspace):
                 for v in s.VariantFlags(t, variant_flags) ]
     s.tests = ShardTests(s.tests, options.shard_count, options.shard_run)
     num_tests += len(s.tests)
+    for t in s.tests:
+      t.id = test_id
+      test_id += 1
 
   if options.cat:
     return 0  # We're done here.
index 07c221e..2b2f876 100644 (file)
@@ -73,19 +73,15 @@ class Runner(object):
       for t in self.tests:
         t.duration = self.perfdata.FetchPerfData(t) or 1.0
       self.tests.sort(key=lambda t: t.duration, reverse=True)
-    self._CommonInit(suites, progress_indicator, context)
+    self._CommonInit(len(self.tests), progress_indicator, context)
 
-  def _CommonInit(self, suites, progress_indicator, context):
-    self.total = 0
-    for s in suites:
-      for t in s.tests:
-        t.id = self.total
-        self.total += 1
+  def _CommonInit(self, num_tests, progress_indicator, context):
     self.indicator = progress_indicator
     progress_indicator.runner = self
     self.context = context
     self.succeeded = 0
-    self.remaining = self.total
+    self.total = num_tests
+    self.remaining = num_tests
     self.failed = []
     self.crashed = 0
     self.reran_tests = 0
@@ -136,7 +132,6 @@ class Runner(object):
       test.run += 1
       pool.add([self._GetJob(test)])
       self.remaining += 1
-      self.total += 1
 
   def _ProcessTestNormal(self, test, result, pool):
     self.indicator.AboutToRun(test)
index c842aba..a43a6cf 100644 (file)
@@ -52,6 +52,7 @@ def GetPeers():
 class NetworkedRunner(execution.Runner):
   def __init__(self, suites, progress_indicator, context, peers, workspace):
     self.suites = suites
+    num_tests = 0
     datapath = os.path.join("out", "testrunner_data")
     # TODO(machenbach): These fields should exist now in the superclass.
     # But there is no super constructor call. Check if this is a problem.
@@ -60,7 +61,8 @@ class NetworkedRunner(execution.Runner):
     for s in suites:
       for t in s.tests:
         t.duration = self.perfdata.FetchPerfData(t) or 1.0
-    self._CommonInit(suites, progress_indicator, context)
+      num_tests += len(s.tests)
+    self._CommonInit(num_tests, progress_indicator, context)
     self.tests = []  # Only used if we need to fall back to local execution.
     self.tests_lock = threading.Lock()
     self.peers = peers