doing memory analysis on the Python interpreter, which process tends to
consume too many resources to run the full regression test non-stop.
--S is used to continue running tests after an aborted run. It will
-maintain the order a standard run (ie, this assumes -r is not used).
+-S is used to resume running tests after an interrupted run. It will
+maintain the order a standard run (i.e. it assumes -r is not used).
This is useful after the tests have prematurely stopped for some external
-reason and you want to start running from where you left off rather
-than starting from the beginning.
+reason and you want to resume the run from where you left off rather
+than starting from the beginning. Note: this is different from --prioritize.
+
+--prioritize is used to influence the order of selected tests, such that
+the tests listed as an argument are executed first. This is especially
+useful when combined with -j and -r to pin the longest-running tests
+to start at the beginning of a test run. Pass --prioritize=test_a,test_b
+to make test_a run first, followed by test_b, and then the other tests.
+If test_a wasn't selected for execution by regular means, --prioritize will
+not make it execute.
-f reads the names of tests from the file given as f's argument, one
or more test names per line. Whitespace is ignored. Blank lines and
help='wait for user input, e.g., allow a debugger '
'to be attached')
group.add_argument('-S', '--start', metavar='START',
- help='the name of the test at which to start.' +
+ help='resume an interrupted run at the following test.' +
more_details)
group.add_argument('-p', '--python', metavar='PYTHON',
help='Command to run Python test subprocesses with.')
group = parser.add_argument_group('Selecting tests')
group.add_argument('-r', '--randomize', action='store_true',
help='randomize test execution order.' + more_details)
+ group.add_argument('--prioritize', metavar='TEST1,TEST2,...',
+ action='append', type=priority_list,
+ help='select these tests first, even if the order is'
+ ' randomized.' + more_details)
group.add_argument('-f', '--fromfile', metavar='FILE',
help='read names of tests to run from a file.' +
more_details)
return u
+def priority_list(string):
+ return string.split(",")
+
+
def _parse_args(args, **kwargs):
# Defaults
ns = Namespace()
print(msg, file=sys.stderr, flush=True)
sys.exit(2)
+ ns.prioritize = [
+ test
+ for test_list in (ns.prioritize or ())
+ for test in test_list
+ ]
+
return ns
self.random_seed = random.getrandbits(32)
else:
self.random_seed = ns.random_seed
+ self.prioritize_tests: tuple[str, ...] = tuple(ns.prioritize)
self.parallel_threads = ns.parallel_threads
if self.randomize:
random.shuffle(selected)
+ for priority_test in reversed(self.prioritize_tests):
+ try:
+ selected.remove(priority_test)
+ except ValueError:
+ print(f"warning: --prioritize={priority_test} used"
+ f" but test not actually selected")
+ continue
+ else:
+ selected.insert(0, priority_test)
+
return (tuple(selected), tests)
@staticmethod