2018-01-05 13:34:17 +00: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):
|
2018-01-09 13:56:18 +00:00
|
|
|
"""First processor in the chain that passes all tests to the next processor.
|
|
|
|
"""
|
|
|
|
|
2019-01-30 12:20:33 +00:00
|
|
|
def __init__(self, tests):
|
|
|
|
super(LoadProc, self).__init__()
|
2018-01-05 13:34:17 +00:00
|
|
|
|
2019-01-30 12:20:33 +00:00
|
|
|
self.tests = tests
|
|
|
|
|
|
|
|
def load_initial_tests(self, initial_batch_size):
|
|
|
|
"""
|
|
|
|
Args:
|
|
|
|
exec_proc: execution processor that the tests are being loaded into
|
|
|
|
initial_batch_size: initial number of tests to load
|
|
|
|
"""
|
|
|
|
loaded_tests = 0
|
|
|
|
while loaded_tests < initial_batch_size:
|
|
|
|
try:
|
|
|
|
t = next(self.tests)
|
|
|
|
except StopIteration:
|
|
|
|
return
|
|
|
|
|
|
|
|
if self._send_test(t):
|
|
|
|
loaded_tests += 1
|
2018-01-05 13:34:17 +00:00
|
|
|
|
2018-01-09 13:56:18 +00:00
|
|
|
def next_test(self, test):
|
|
|
|
assert False, 'Nothing can be connected to the LoadProc'
|
|
|
|
|
2018-01-15 08:03:48 +00:00
|
|
|
def result_for(self, test, result):
|
2019-01-30 12:20:33 +00:00
|
|
|
try:
|
|
|
|
while not self._send_test(next(self.tests)):
|
|
|
|
pass
|
|
|
|
except StopIteration:
|
|
|
|
# No more tests to load.
|
|
|
|
pass
|