blob: 543afe7a067475e4c5ca375b014878aa24c206be [file] [log] [blame]
Nadeem Vawda3c01d162011-08-01 23:48:26 +02001"""Run Python's test suite in a fast, rigorous way.
2
3The defaults are meant to be thorough but to skip certain resources are not
4used (by default) which can consume a lot of time and resources (e.g.,
5largefile) or can be distracting (e.g., audio and gui). These defaults
6can be overridden by simply passing a -u option to this script.
7
8"""
9
10import os
11import sys
12import test.support
13
14
15def is_multiprocess_flag(arg):
16 return arg.startswith('-j') or arg.startswith('--multiprocess')
17
18
19def is_resource_use_flag(arg):
20 return arg.startswith('-u') or arg.startswith('--use')
21
22
23def main(regrtest_args):
24 args = [sys.executable,
25 '-W', 'default', # Warnings set to 'default'
26 '-bb', # Warnings about bytes/bytearray
27 '-E', # Ignore environment variables
28 ]
29 # Allow user-specified interpreter options to override our defaults.
30 args.extend(test.support.args_from_interpreter_flags())
31 args.extend(['-m', 'test', # Run the test suite
32 '-r', # Randomize test order
33 '-w', # Re-run failed tests in verbose mode
34 ])
35 if not any(is_multiprocess_flag(arg) for arg in regrtest_args):
36 args.extend(['-j', '0']) # Use all CPU cores
37 if not any(is_resource_use_flag(arg) for arg in regrtest_args):
38 args.extend(['-u', 'all,-largefile,-audio,-gui'])
39 args.extend(regrtest_args)
40 print(' '.join(args))
41 os.execv(sys.executable, args)
42
43
44if __name__ == '__main__':
45 main(sys.argv[1:])