1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-16 14:35:03 -05:00

runtests: run the DICT server on a random port number

Removed support for -b (base port number)

Closes #5783
This commit is contained in:
Daniel Stenberg 2020-08-05 15:11:22 +02:00
parent 865b9382ba
commit 82ed83ae30
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 26 additions and 47 deletions

View File

@ -55,8 +55,6 @@ Prefix a keyword with a tilde (~) to still run it, but ignore the results.
.IP "-a" .IP "-a"
Continue running the rest of the test cases even if one test fails. By Continue running the rest of the test cases even if one test fails. By
default, the test script stops as soon as an error is detected. default, the test script stops as soon as an error is detected.
.IP "-bN"
Use N as the base TCP/UDP port number on which to start the test servers.
.IP "-c <curl>" .IP "-c <curl>"
Provide a path to a custom curl binary to run the tests with. Default is the Provide a path to a custom curl binary to run the tests with. Default is the
curl executable in the build tree. curl executable in the build tree.

View File

@ -127,10 +127,6 @@ my $HOST6IP="[::1]"; # address on which the test server listens
my $CLIENTIP="127.0.0.1"; # address which curl uses for incoming connections my $CLIENTIP="127.0.0.1"; # address which curl uses for incoming connections
my $CLIENT6IP="[::1]"; # address which curl uses for incoming connections my $CLIENT6IP="[::1]"; # address which curl uses for incoming connections
my $base = 8990; # base port number
my $minport; # minimum used port number
my $maxport; # maximum used port number
my $noport="[not running]"; my $noport="[not running]";
my $NOLISTENPORT=47; # port number we use for a local non-listening service my $NOLISTENPORT=47; # port number we use for a local non-listening service
@ -2405,7 +2401,7 @@ sub runsocksserver {
# start the dict server # start the dict server
# #
sub rundictserver { sub rundictserver {
my ($verbose, $alt, $port) = @_; my ($verbose, $alt) = @_;
my $proto = "dict"; my $proto = "dict";
my $ip = $HOSTIP; my $ip = $HOSTIP;
my $ipvnum = 4; my $ipvnum = 4;
@ -2442,11 +2438,16 @@ sub rundictserver {
$flags .= "--verbose 1 " if($debugprotocol); $flags .= "--verbose 1 " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
$flags .= "--id $idnum " if($idnum > 1); $flags .= "--id $idnum " if($idnum > 1);
$flags .= "--port $port --srcdir \"$srcdir\" "; $flags .= "--srcdir \"$srcdir\" ";
$flags .= "--host $HOSTIP"; $flags .= "--host $HOSTIP";
my $cmd = "$srcdir/dictserver.py $flags"; my $port = 29000;
my ($dictpid, $pid2) = startnew($cmd, $pidfile, 15, 0); my ($dictpid, $pid2);
for(1 .. 10) {
$port += int(rand(900));
my $aflags = "--port $port $flags";
my $cmd = "$srcdir/dictserver.py $aflags";
($dictpid, $pid2) = startnew($cmd, $pidfile, 15, 0);
if($dictpid <= 0 || !pidexists($dictpid)) { if($dictpid <= 0 || !pidexists($dictpid)) {
# it is NOT alive # it is NOT alive
@ -2454,26 +2455,18 @@ sub rundictserver {
stopserver($server, "$pid2"); stopserver($server, "$pid2");
displaylogs($testnumcheck); displaylogs($testnumcheck);
$doesntrun{$pidfile} = 1; $doesntrun{$pidfile} = 1;
return (0,0); $dictpid = $pid2 = 0;
next;
} }
$doesntrun{$pidfile} = 0;
# Server is up. Verify that we can speak to it.
my $pid3 = verifyserver($proto, $ipvnum, $idnum, $ip, $port);
if(!$pid3) {
logmsg "RUN: $srvrname server failed verification\n";
# failed to talk to it properly. Kill the server and return failure
stopserver($server, "$dictpid $pid2");
displaylogs($testnumcheck);
$doesntrun{$pidfile} = 1;
return (0,0);
}
$pid2 = $pid3;
if($verbose) { if($verbose) {
logmsg "RUN: $srvrname server is now running PID $dictpid\n"; logmsg "RUN: $srvrname server PID $dictpid port $port\n";
}
last;
} }
return ($dictpid, $pid2); return ($dictpid, $pid2, $port);
} }
####################################################################### #######################################################################
@ -3217,7 +3210,6 @@ sub checksystem {
$run_event_based?"event-based ":""); $run_event_based?"event-based ":"");
logmsg sprintf("%s\n", $libtool?"Libtool ":""); logmsg sprintf("%s\n", $libtool?"Libtool ":"");
logmsg ("* Seed: $randseed\n"); logmsg ("* Seed: $randseed\n");
logmsg ("* Port range: $minport-$maxport\n");
if($verbose) { if($verbose) {
if($has_unix) { if($has_unix) {
@ -4960,7 +4952,7 @@ sub startservers {
} }
elsif($what eq "dict") { elsif($what eq "dict") {
if(!$run{'dict'}) { if(!$run{'dict'}) {
($pid, $pid2) = rundictserver($verbose, "", $DICTPORT); ($pid, $pid2, $DICTPORT) = rundictserver($verbose, "");
if($pid <= 0) { if($pid <= 0) {
return "failed starting DICT server"; return "failed starting DICT server";
} }
@ -5209,12 +5201,6 @@ while(@ARGV) {
# verbose output # verbose output
$verbose=1; $verbose=1;
} }
elsif($ARGV[0] =~ /^-b(.*)/) {
my $portno=$1;
if($portno =~ s/(\d+)$//) {
$base = int $1;
}
}
elsif ($ARGV[0] eq "-c") { elsif ($ARGV[0] eq "-c") {
# use this path to curl instead of default # use this path to curl instead of default
$DBGCURL=$CURL="\"$ARGV[1]\""; $DBGCURL=$CURL="\"$ARGV[1]\"";
@ -5336,7 +5322,6 @@ while(@ARGV) {
Usage: runtests.pl [options] [test selection(s)] Usage: runtests.pl [options] [test selection(s)]
-a continue even if a test fails -a continue even if a test fails
-am automake style output PASS/FAIL: [number] [name] -am automake style output PASS/FAIL: [number] [name]
-bN use base port number N for test servers (default $base)
-c path use this curl executable -c path use this curl executable
-d display server debug info -d display server debug info
-e event-based execution -e event-based execution
@ -5484,12 +5469,8 @@ if ($gdbthis) {
} }
} }
$minport = $base; # original base port number
$DICTPORT = $base++; # DICT port
$HTTPUNIXPATH = "http$$.sock"; # HTTP server Unix domain socket path $HTTPUNIXPATH = "http$$.sock"; # HTTP server Unix domain socket path
$maxport = $base-1; # updated base port number
####################################################################### #######################################################################
# clear and create logging directory: # clear and create logging directory:
# #