27
27
Additional option details:
28
28
29
29
-r randomizes test execution order. You can use --randseed=int to provide an
30
- int seed value for the randomizer; this is useful for reproducing troublesome
31
- test orders.
30
+ int seed value for the randomizer. The randseed value will be used
31
+ to set seeds for all random usages in tests
32
+ (including randomizing the tests order if -r is set).
33
+ By default we always set random seed, but do not randomize test order.
34
+ Use --no-use-randseed to disable random seeding.
32
35
33
36
-s On the first invocation of regrtest using -s, the first test file found
34
37
or the first test file given on the command line is run, and the name of
@@ -156,6 +159,7 @@ def __init__(self, **kwargs) -> None:
156
159
self .list_tests = False
157
160
self .single = False
158
161
self .randomize = False
162
+ self .use_random_seed = True
159
163
self .fromfile = None
160
164
self .fail_env_changed = False
161
165
self .use_resources = None
@@ -229,6 +233,13 @@ def _create_parser():
229
233
more_details )
230
234
group .add_argument ('-p' , '--python' , metavar = 'PYTHON' ,
231
235
help = 'Command to run Python test subprocesses with.' )
236
+ group .add_argument ('--randseed' , metavar = 'SEED' ,
237
+ dest = 'random_seed' , type = int ,
238
+ help = 'pass a global random seed' )
239
+ group .add_argument ('--use-randseed' ,
240
+ dest = 'use_random_seed' ,
241
+ action = argparse .BooleanOptionalAction ,
242
+ help = 'control if random should be seeded' )
232
243
233
244
group = parser .add_argument_group ('Verbosity' )
234
245
group .add_argument ('-v' , '--verbose' , action = 'count' ,
@@ -249,10 +260,6 @@ def _create_parser():
249
260
group = parser .add_argument_group ('Selecting tests' )
250
261
group .add_argument ('-r' , '--randomize' , action = 'store_true' ,
251
262
help = 'randomize test execution order.' + more_details )
252
- group .add_argument ('--randseed' , metavar = 'SEED' ,
253
- dest = 'random_seed' , type = int ,
254
- help = 'pass a random seed to reproduce a previous '
255
- 'random run' )
256
263
group .add_argument ('-f' , '--fromfile' , metavar = 'FILE' ,
257
264
help = 'read names of tests to run from a file.' +
258
265
more_details )
@@ -483,6 +490,11 @@ def _parse_args(args, **kwargs):
483
490
ns .use_resources .remove (r )
484
491
elif r not in ns .use_resources :
485
492
ns .use_resources .append (r )
493
+ if not ns .use_random_seed :
494
+ if ns .random_seed is not None :
495
+ parser .error ("--no-use-randseed and --randseed=... don't go together" )
496
+ if ns .randomize :
497
+ parser .error ("--no-use-randseed and --randomize don't go together" )
486
498
if ns .random_seed is not None :
487
499
ns .randomize = True
488
500
if ns .verbose :
0 commit comments