runtests: use a per-runner random seed
Each runner needs a unique random seed to reduce the chance of port number collisions. The new scheme uses a consistent per-runner source of randomness which results in deterministic behaviour, as it did before. Ref: #10818
This commit is contained in:
parent
4317c5549b
commit
78d8bc4c63
@ -50,6 +50,7 @@ BEGIN {
|
||||
$proxy_address
|
||||
$PROXYIN
|
||||
$pwd
|
||||
$randseed
|
||||
$run_event_based
|
||||
$SERVERIN
|
||||
$srcdir
|
||||
@ -80,6 +81,7 @@ our $run_event_based; # run curl with --test-event to test the event API
|
||||
our $automakestyle; # use automake-like test status output format
|
||||
our $anyway; # continue anyway, even if a test fail
|
||||
our $CURLVERSION=""; # curl's reported version number
|
||||
our $randseed = 0; # random number seed
|
||||
|
||||
# paths
|
||||
our $pwd = getcwd(); # current working directory
|
||||
|
||||
@ -168,6 +168,13 @@ sub runner_init {
|
||||
$ENV{'XDG_CONFIG_HOME'}=$ENV{'HOME'};
|
||||
$ENV{'COLUMNS'}=79; # screen width!
|
||||
|
||||
# Incorporate the $logdir into the random seed and re-seed the PRNG.
|
||||
# This gives each runner a unique yet consistent seed which provides
|
||||
# more unique port number selection in each runner, yet is deterministic
|
||||
# across runs.
|
||||
$randseed += unpack('%16C*', $logdir);
|
||||
srand $randseed;
|
||||
|
||||
# create pipes for communication with runner
|
||||
my ($thisrunnerr, $thiscontrollerw, $thiscontrollerr, $thisrunnerw);
|
||||
pipe $thisrunnerr, $thiscontrollerw;
|
||||
|
||||
@ -177,7 +177,6 @@ my $clearlocks; # force removal of files by killing locking processes
|
||||
my $postmortem; # display detailed info about failed tests
|
||||
my $run_disabled; # run the specific tests even if listed in DISABLED
|
||||
my $scrambleorder;
|
||||
my $randseed = 0;
|
||||
my $jobs = 0;
|
||||
|
||||
# Azure Pipelines specific variables
|
||||
|
||||
Loading…
Reference in New Issue
Block a user