|
44 | 44 | doing memory analysis on the Python interpreter, which process tends to |
45 | 45 | consume too many resources to run the full regression test non-stop. |
46 | 46 |
|
47 | | --S is used to continue running tests after an aborted run. It will |
48 | | -maintain the order a standard run (ie, this assumes -r is not used). |
| 47 | +-S is used to resume running tests after an interrupted run. It will |
| 48 | +maintain the order a standard run (i.e. it assumes -r is not used). |
49 | 49 | This is useful after the tests have prematurely stopped for some external |
50 | | -reason and you want to start running from where you left off rather |
51 | | -than starting from the beginning. |
| 50 | +reason and you want to resume the run from where you left off rather |
| 51 | +than starting from the beginning. Note: this is different from --prioritize. |
| 52 | +
|
| 53 | +--prioritize is used to influence the order of selected tests, such that |
| 54 | +the tests listed as an argument are executed first. This is especially |
| 55 | +useful when combined with -j and -r to pin the longest-running tests |
| 56 | +to start at the beginning of a test run. Pass --prioritize=test_a,test_b |
| 57 | +to make test_a run first, followed by test_b, and then the other tests. |
| 58 | +If test_a wasn't selected for execution by regular means, --prioritize will |
| 59 | +not make it execute. |
52 | 60 |
|
53 | 61 | -f reads the names of tests from the file given as f's argument, one |
54 | 62 | or more test names per line. Whitespace is ignored. Blank lines and |
|
87 | 95 | The argument is a comma-separated list of words indicating the |
88 | 96 | resources to test. Currently only the following are defined: |
89 | 97 |
|
90 | | - all - Enable all special resources. |
| 98 | + all - Enable all special resources. |
| 99 | +
|
| 100 | + none - Disable all special resources (this is the default). |
91 | 101 |
|
92 | | - none - Disable all special resources (this is the default). |
| 102 | + audio - Tests that use the audio device. (There are known |
| 103 | + cases of broken audio drivers that can crash Python or |
| 104 | + even the Linux kernel.) |
93 | 105 |
|
94 | | - audio - Tests that use the audio device. (There are known |
95 | | - cases of broken audio drivers that can crash Python or |
96 | | - even the Linux kernel.) |
| 106 | + curses - Tests that use curses and will modify the terminal's |
| 107 | + state and output modes. |
97 | 108 |
|
98 | | - curses - Tests that use curses and will modify the terminal's |
99 | | - state and output modes. |
| 109 | + largefile - It is okay to run some test that may create huge |
| 110 | + files. These tests can take a long time and may |
| 111 | + consume >2 GiB of disk space temporarily. |
100 | 112 |
|
101 | | - largefile - It is okay to run some test that may create huge |
102 | | - files. These tests can take a long time and may |
103 | | - consume >2 GiB of disk space temporarily. |
| 113 | + extralargefile - Like 'largefile', but even larger (and slower). |
104 | 114 |
|
105 | | - network - It is okay to run tests that use external network |
106 | | - resource, e.g. testing SSL support for sockets. |
| 115 | + network - It is okay to run tests that use external network |
| 116 | + resource, e.g. testing SSL support for sockets. |
107 | 117 |
|
108 | | - decimal - Test the decimal module against a large suite that |
109 | | - verifies compliance with standards. |
| 118 | + decimal - Test the decimal module against a large suite that |
| 119 | + verifies compliance with standards. |
110 | 120 |
|
111 | | - cpu - Used for certain CPU-heavy tests. |
| 121 | + cpu - Used for certain CPU-heavy tests. |
112 | 122 |
|
113 | | - walltime - Long running but not CPU-bound tests. |
| 123 | + walltime - Long running but not CPU-bound tests. |
114 | 124 |
|
115 | | - subprocess Run all tests for the subprocess module. |
| 125 | + subprocess Run all tests for the subprocess module. |
116 | 126 |
|
117 | | - urlfetch - It is okay to download files required on testing. |
| 127 | + urlfetch - It is okay to download files required on testing. |
118 | 128 |
|
119 | | - gui - Run tests that require a running GUI. |
| 129 | + gui - Run tests that require a running GUI. |
120 | 130 |
|
121 | | - tzdata - Run tests that require timezone data. |
| 131 | + tzdata - Run tests that require timezone data. |
122 | 132 |
|
123 | 133 | To enable all resources except one, use '-uall,-<resource>'. For |
124 | 134 | example, to run all the tests except for the gui tests, give the |
@@ -158,13 +168,15 @@ def __init__(self, **kwargs) -> None: |
158 | 168 | self.print_slow = False |
159 | 169 | self.random_seed = None |
160 | 170 | self.use_mp = None |
| 171 | + self.parallel_threads = None |
161 | 172 | self.forever = False |
162 | 173 | self.header = False |
163 | 174 | self.failfast = False |
164 | 175 | self.match_tests: TestFilter = [] |
165 | 176 | self.pgo = False |
166 | 177 | self.pgo_extended = False |
167 | 178 | self.tsan = False |
| 179 | + self.tsan_parallel = False |
168 | 180 | self.worker_json = None |
169 | 181 | self.start = None |
170 | 182 | self.timeout = None |
@@ -232,7 +244,7 @@ def _create_parser(): |
232 | 244 | help='wait for user input, e.g., allow a debugger ' |
233 | 245 | 'to be attached') |
234 | 246 | group.add_argument('-S', '--start', metavar='START', |
235 | | - help='the name of the test at which to start.' + |
| 247 | + help='resume an interrupted run at the following test.' + |
236 | 248 | more_details) |
237 | 249 | group.add_argument('-p', '--python', metavar='PYTHON', |
238 | 250 | help='Command to run Python test subprocesses with.') |
@@ -262,6 +274,10 @@ def _create_parser(): |
262 | 274 | group.add_argument('--no-randomize', dest='no_randomize', action='store_true', |
263 | 275 | help='do not randomize test execution order, even if ' |
264 | 276 | 'it would be implied by another option') |
| 277 | + group.add_argument('--prioritize', metavar='TEST1,TEST2,...', |
| 278 | + action='append', type=priority_list, |
| 279 | + help='select these tests first, even if the order is' |
| 280 | + ' randomized.' + more_details) |
265 | 281 | group.add_argument('-f', '--fromfile', metavar='FILE', |
266 | 282 | help='read names of tests to run from a file.' + |
267 | 283 | more_details) |
@@ -317,6 +333,10 @@ def _create_parser(): |
317 | 333 | 'a single process, ignore -jN option, ' |
318 | 334 | 'and failed tests are also rerun sequentially ' |
319 | 335 | 'in the same process') |
| 336 | + group.add_argument('--parallel-threads', metavar='PARALLEL_THREADS', |
| 337 | + type=int, |
| 338 | + help='run copies of each test in PARALLEL_THREADS at ' |
| 339 | + 'once') |
320 | 340 | group.add_argument('-T', '--coverage', action='store_true', |
321 | 341 | dest='trace', |
322 | 342 | help='turn on code coverage tracing using the trace ' |
@@ -347,6 +367,9 @@ def _create_parser(): |
347 | 367 | help='enable extended PGO training (slower training)') |
348 | 368 | group.add_argument('--tsan', dest='tsan', action='store_true', |
349 | 369 | help='run a subset of test cases that are proper for the TSAN test') |
| 370 | + group.add_argument('--tsan-parallel', action='store_true', |
| 371 | + help='run a subset of test cases that are appropriate ' |
| 372 | + 'for TSAN with `--parallel-threads=N`') |
350 | 373 | group.add_argument('--fail-env-changed', action='store_true', |
351 | 374 | help='if a test file alters the environment, mark ' |
352 | 375 | 'the test as failed') |
@@ -398,6 +421,10 @@ def resources_list(string): |
398 | 421 | return u |
399 | 422 |
|
400 | 423 |
|
| 424 | +def priority_list(string): |
| 425 | + return string.split(",") |
| 426 | + |
| 427 | + |
401 | 428 | def _parse_args(args, **kwargs): |
402 | 429 | # Defaults |
403 | 430 | ns = Namespace() |
@@ -549,4 +576,10 @@ def _parse_args(args, **kwargs): |
549 | 576 | print(msg, file=sys.stderr, flush=True) |
550 | 577 | sys.exit(2) |
551 | 578 |
|
| 579 | + ns.prioritize = [ |
| 580 | + test |
| 581 | + for test_list in (ns.prioritize or ()) |
| 582 | + for test in test_list |
| 583 | + ] |
| 584 | + |
552 | 585 | return ns |
0 commit comments