Skip to content

Commit

Permalink
run_wml_tests: Add command-line option to limit test batch size
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 28, 2021
1 parent aea1f56 commit 2814b89
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion run_wml_tests
Expand Up @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit 2814b89

Please sign in to comment.