2018-03-07 08:54:53 +01:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
from . import base
|
|
|
|
|
|
|
|
class LoadProc(base.TestProc):
|
|
|
|
"""First processor in the chain that passes all tests to the next processor.
|
|
|
|
"""
|
|
|
|
|
2022-09-21 13:28:42 +02:00
|
|
|
def __init__(self, tests, initial_batch_size=float('inf')):
|
2019-03-15 18:35:06 +05:30
|
|
|
super(LoadProc, self).__init__()
|
2018-03-07 08:54:53 +01:00
|
|
|
|
2019-03-15 18:35:06 +05:30
|
|
|
self.tests = tests
|
2022-09-21 13:28:42 +02:00
|
|
|
self.initial_batch_size = initial_batch_size
|
2019-03-15 18:35:06 +05:30
|
|
|
|
|
|
|
|
2022-09-21 13:28:42 +02:00
|
|
|
def load_initial_tests(self):
|
|
|
|
"""Send an initial batch of tests down to executor"""
|
|
|
|
if not self.initial_batch_size:
|
|
|
|
return
|
|
|
|
to_load = self.initial_batch_size
|
|
|
|
for t in self.tests:
|
2019-03-15 18:35:06 +05:30
|
|
|
if self._send_test(t):
|
2022-09-21 13:28:42 +02:00
|
|
|
to_load -= 1
|
|
|
|
if not to_load:
|
|
|
|
break
|
2018-03-07 08:54:53 +01:00
|
|
|
|
|
|
|
def next_test(self, test):
|
2022-09-21 13:28:42 +02:00
|
|
|
assert False, \
|
|
|
|
'Nothing can be connected to the LoadProc' # pragma: no cover
|
2018-03-07 08:54:53 +01:00
|
|
|
|
|
|
|
def result_for(self, test, result):
|
2022-09-21 13:28:42 +02:00
|
|
|
for t in self.tests:
|
|
|
|
if self._send_test(t):
|
|
|
|
break
|