1# Copyright 2018 the V8 project authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from . import base 6 7 8class LoadProc(base.TestProc): 9 """First processor in the chain that passes all tests to the next processor. 10 """ 11 12 def __init__(self, tests): 13 super(LoadProc, self).__init__() 14 15 self.tests = tests 16 17 def load_initial_tests(self, initial_batch_size): 18 """ 19 Args: 20 exec_proc: execution processor that the tests are being loaded into 21 initial_batch_size: initial number of tests to load 22 """ 23 loaded_tests = 0 24 while loaded_tests < initial_batch_size: 25 try: 26 t = next(self.tests) 27 except StopIteration: 28 return 29 30 if self._send_test(t): 31 loaded_tests += 1 32 33 def next_test(self, test): 34 assert False, 'Nothing can be connected to the LoadProc' 35 36 def result_for(self, test, result): 37 try: 38 while not self._send_test(next(self.tests)): 39 pass 40 except StopIteration: 41 # No more tests to load. 42 pass 43