run_wml_tests: Add command-line option to limit test batch size

This commit is contained in:
Celtic Minstrel 2021-02-28 01:29:11 -05:00 committed by Celtic Minstrel
parent 10959dae17
commit c1c5b5dd7d

View file

@ -181,8 +181,14 @@ def test_batcher(test_list):
expected_to_pass.append(test)
else:
yield [test]
if len(expected_to_pass) > 0:
if len(expected_to_pass) == 0:
return
if options.batch_max == 0:
yield expected_to_pass
return
while len(expected_to_pass) > 0:
yield expected_to_pass[0:options.batch_max]
expected_to_pass = expected_to_pass[options.batch_max:]
def test_nobatcher(test_list):
"""A generator function that provides the same API as test_batcher but
@ -206,6 +212,8 @@ if __name__ == '__main__':
help="New timer value to use for batched tests, instead of 300s as default.")
ap.add_argument("-bd", "--batch-disable", action="store_true",
help="Disable test batching, may be useful if debugging a small subset of tests.")
ap.add_argument("-bm", "--batch-max", type=int, default=0,
help="Maximum number of tests to do in a batch. Default no limit.")
ap.add_argument("-s", "--no-strict", dest="strict_mode", action="store_false",
help="Disable strict mode. By default, we run wesnoth with the option --log-strict=warning to ensure errors result in a failed test.")
ap.add_argument("-d", "--debug_bin", action="store_true",