diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2020-11-03 17:41:58 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-11-13 17:19:05 +1100 |
commit | c75ce379100993f41a7502986146e735367cf8aa (patch) | |
tree | 587eb895929a5c4ecee9c67f0b3cf412cb3b5215 | |
parent | ccfd535af48f2ffc00f7306648b60624894d3004 (diff) |
tests/run-multitests.py: Add a -p flag to run permutations of instances.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
-rwxr-xr-x | tests/run-multitests.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/run-multitests.py b/tests/run-multitests.py index 5b8e70e92..cdb2730ed 100755 --- a/tests/run-multitests.py +++ b/tests/run-multitests.py @@ -6,6 +6,7 @@ import sys, os, time, re, select import argparse +import itertools import subprocess import tempfile @@ -418,6 +419,13 @@ def main(): cmd_parser.add_argument( "-i", "--instance", action="append", default=[], help="instance(s) to run the tests on" ) + cmd_parser.add_argument( + "-p", + "--permutations", + type=int, + default=1, + help="repeat the test with this many permutations of the instance order", + ) cmd_parser.add_argument("files", nargs="+", help="input test files") cmd_args = cmd_parser.parse_args() @@ -450,8 +458,14 @@ def main(): for _ in range(max_instances - len(instances_test)): instances_test.append(PyInstanceSubProcess([MICROPYTHON])) + all_pass = True try: - all_pass = run_tests(test_files, instances_truth, instances_test) + for i, instances_test_permutation in enumerate(itertools.permutations(instances_test)): + if i >= cmd_args.permutations: + break + + all_pass &= run_tests(test_files, instances_truth, instances_test_permutation) + finally: for i in instances_truth: i.close() |