Commit f8fe5c6b authored by machenbach's avatar machenbach Committed by Commit bot

Reland [test] Refactoring - Let runner handle test IDs.

Reason for revert:
All build problems had other reasons.

Original issue's description:
> Revert of [test] Refactoring - Let runner handle test IDs. (patchset #1 id:1 of https://codereview.chromium.org/1168303007/)
>
> 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
>
> Committed: https://crrev.com/f83444a5f24381ec9ccc28b1e18e1e9370415bb2
> Cr-Commit-Position: refs/heads/master@{#28891}

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

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

Cr-Commit-Position: refs/heads/master@{#28903}
parent 05507cc3
......@@ -584,7 +584,6 @@ 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)
......@@ -602,9 +601,6 @@ 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.
......
......@@ -73,15 +73,19 @@ 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(len(self.tests), progress_indicator, context)
self._CommonInit(suites, progress_indicator, context)
def _CommonInit(self, num_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
self.indicator = progress_indicator
progress_indicator.SetRunner(self)
self.context = context
self.succeeded = 0
self.total = num_tests
self.remaining = num_tests
self.remaining = self.total
self.failed = []
self.crashed = 0
self.reran_tests = 0
......@@ -132,6 +136,7 @@ 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)
......
......@@ -52,7 +52,6 @@ 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.
......@@ -61,8 +60,7 @@ class NetworkedRunner(execution.Runner):
for s in suites:
for t in s.tests:
t.duration = self.perfdata.FetchPerfData(t) or 1.0
num_tests += len(s.tests)
self._CommonInit(num_tests, progress_indicator, context)
self._CommonInit(suites, progress_indicator, context)
self.tests = [] # Only used if we need to fall back to local execution.
self.tests_lock = threading.Lock()
self.peers = peers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment