2727 Additional option details:
2828
2929-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.
3235
3336-s On the first invocation of regrtest using -s, the first test file found
3437or the first test file given on the command line is run, and the name of
@@ -156,6 +159,7 @@ def __init__(self, **kwargs) -> None:
156159 self .list_tests = False
157160 self .single = False
158161 self .randomize = False
162+ self .use_random_seed = True
159163 self .fromfile = None
160164 self .fail_env_changed = False
161165 self .use_resources = None
@@ -229,6 +233,13 @@ def _create_parser():
229233 more_details )
230234 group .add_argument ('-p' , '--python' , metavar = 'PYTHON' ,
231235 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' )
232243
233244 group = parser .add_argument_group ('Verbosity' )
234245 group .add_argument ('-v' , '--verbose' , action = 'count' ,
@@ -249,10 +260,6 @@ def _create_parser():
249260 group = parser .add_argument_group ('Selecting tests' )
250261 group .add_argument ('-r' , '--randomize' , action = 'store_true' ,
251262 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' )
256263 group .add_argument ('-f' , '--fromfile' , metavar = 'FILE' ,
257264 help = 'read names of tests to run from a file.' +
258265 more_details )
@@ -483,6 +490,11 @@ def _parse_args(args, **kwargs):
483490 ns .use_resources .remove (r )
484491 elif r not in ns .use_resources :
485492 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" )
486498 if ns .random_seed is not None :
487499 ns .randomize = True
488500 if ns .verbose :
0 commit comments