Files
Michael Achenbach b4242d1072 Revert "[test] Output process list after failures on Windows"
This reverts commit 743641bb8f.

Reason for revert:
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20-%20coverage/7415/overview

Original change's description:
> [test] Output process list after failures on Windows
>
> This aims to identify background processes running while other
> failures occur during testing.
>
> Bug: v8:14373
> Change-Id: I0fa63bfcddf636bddb94cb6d0784f834b78658f1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4931688
> Reviewed-by: Liviu Rau <liviurau@google.com>
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#90357}

Bug: v8:14373
Change-Id: I7cbd8f491c98f572c35cbbc4cc81f52a54c54124
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4930894
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#90358}
2023-10-11 12:43:11 +00:00

78 lines
2.2 KiB
Python

# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from . import base
JobResult = collections.namedtuple('JobResult', ['id', 'result'])
class Job(object):
def __init__(self, test_id, cmd, outproc, keep_output):
self.test_id = test_id
self.cmd = cmd
self.outproc = outproc
self.keep_output = keep_output
def run(self, process_ctx):
output = self.cmd.execute()
reduction = process_ctx.result_reduction if not self.keep_output else None
result = self.outproc.process(output, reduction)
return JobResult(self.test_id, result)
class ExecutionProc(base.TestProc):
"""Last processor in the chain. Instead of passing tests further it creates
commands and output processors, executes them in multiple worker processes and
sends results to the previous processor.
"""
def __init__(self, ctx, jobs, outproc_factory=None):
super(ExecutionProc, self).__init__()
self.ctx = ctx
self.ctx.pool.init(jobs, notify_function=self.notify_previous)
self._outproc_factory = outproc_factory or (lambda t: t.output_proc)
self._tests = {}
def connect_to(self, next_proc):
assert False, \
'ExecutionProc cannot be connected to anything' # pragma: no cover
def run(self, requirement=None):
for pool_result in self.ctx.pool.results(requirement):
self._unpack_result(pool_result)
def next_test(self, test):
if self.is_stopped:
return False
test_id = test.procid
cmd = test.get_command(self.ctx)
self._tests[test_id] = test, cmd
outproc = self._outproc_factory(test)
self.ctx.pool.add_jobs([Job(test_id, cmd, outproc, test.keep_output)])
return True
def result_for(self, test, result):
assert False, \
'ExecutionProc cannot receive results' # pragma: no cover
def stop(self):
super(ExecutionProc, self).stop()
self.ctx.pool.abort()
def _unpack_result(self, pool_result):
if pool_result.heartbeat:
self.heartbeat()
return
job_result = pool_result.value
test_id, result = job_result
test, result.cmd = self._tests[test_id]
del self._tests[test_id]
self._send_result(test, result)