mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
supports the new 'tool' and 'server' tags
This commit is contained in:
parent
ad6bd530ac
commit
a79990465c
@ -24,6 +24,7 @@ my $CURL="../src/curl"; # what curl executable to run on the tests
|
|||||||
my $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging
|
my $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging
|
||||||
my $LOGDIR="log";
|
my $LOGDIR="log";
|
||||||
my $TESTDIR="data";
|
my $TESTDIR="data";
|
||||||
|
my $LIBDIR="./libtest";
|
||||||
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
|
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
|
||||||
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
|
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
|
||||||
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
|
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
|
||||||
@ -517,6 +518,14 @@ sub singletest {
|
|||||||
return 0; # look successful
|
return 0; # look successful
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my @codepieces = getpart("client", "tool");
|
||||||
|
|
||||||
|
my $tool="";
|
||||||
|
if(@codepieces) {
|
||||||
|
$tool = $codepieces[0];
|
||||||
|
chomp $tool;
|
||||||
|
}
|
||||||
|
|
||||||
# remove previous server output logfile
|
# remove previous server output logfile
|
||||||
unlink($SERVERIN);
|
unlink($SERVERIN);
|
||||||
|
|
||||||
@ -579,8 +588,15 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# run curl, add -v for debug information output
|
my $cmdargs;
|
||||||
my $cmdargs="$out--include -v $cmd";
|
if(!$tool) {
|
||||||
|
# run curl, add -v for debug information output
|
||||||
|
$cmdargs ="$out--include -v $cmd";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$cmdargs = " $cmd"; # $cmd is the command line for the test file
|
||||||
|
$CURLOUT = $STDOUT; # sends received data to stdout
|
||||||
|
}
|
||||||
|
|
||||||
my @stdintest = getpart("client", "stdin");
|
my @stdintest = getpart("client", "stdin");
|
||||||
|
|
||||||
@ -590,11 +606,20 @@ sub singletest {
|
|||||||
|
|
||||||
$cmdargs .= " <$stdinfile";
|
$cmdargs .= " <$stdinfile";
|
||||||
}
|
}
|
||||||
my $CMDLINE="$CURL $cmdargs >$STDOUT 2>$STDERR";
|
my $CMDLINE;
|
||||||
|
|
||||||
|
if(!$tool) {
|
||||||
|
$CMDLINE="$CURL";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$CMDLINE="$LIBDIR/$tool";
|
||||||
|
}
|
||||||
|
|
||||||
|
$CMDLINE .= "$cmdargs >$STDOUT 2>$STDERR";
|
||||||
|
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
print "$CMDLINE\n";
|
print "$CMDLINE\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print CMDLOG "$CMDLINE\n";
|
print CMDLOG "$CMDLINE\n";
|
||||||
|
|
||||||
@ -653,8 +678,7 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my %replyattr = getpartattr("reply", "data");
|
my %replyattr = getpartattr("reply", "data");
|
||||||
if(!$replyattr{'nocheck'} &&
|
if(!$replyattr{'nocheck'} && @reply) {
|
||||||
@reply) {
|
|
||||||
# verify the received data
|
# verify the received data
|
||||||
my @out = loadarray($CURLOUT);
|
my @out = loadarray($CURLOUT);
|
||||||
$res = compare(\@out, \@reply);
|
$res = compare(\@out, \@reply);
|
||||||
@ -790,63 +814,90 @@ my %run;
|
|||||||
|
|
||||||
sub serverfortest {
|
sub serverfortest {
|
||||||
my ($testnum)=@_;
|
my ($testnum)=@_;
|
||||||
|
my @what;
|
||||||
|
|
||||||
if($testnum< 100) {
|
if($testnum< 100) {
|
||||||
# 0 - 99 is for HTTP
|
# 0 - 99 is for HTTP
|
||||||
if(!$run{'http'}) {
|
push @what, "http";
|
||||||
runhttpserver($verbose);
|
|
||||||
$run{'http'}=$HTTPPIDFILE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elsif($testnum< 200) {
|
elsif($testnum< 200) {
|
||||||
# 100 - 199 is for FTP
|
# 100 - 199 is for FTP
|
||||||
if(!$run{'ftp'}) {
|
push @what, "ftp";
|
||||||
runftpserver($verbose);
|
|
||||||
$run{'ftp'}=$FTPPIDFILE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elsif($testnum< 300) {
|
elsif($testnum< 300) {
|
||||||
# 200 - 299 is for FILE, no server!
|
# 200 - 299 is for FILE, no server!
|
||||||
$run{'file'}="moo";
|
push @what, "file";
|
||||||
}
|
}
|
||||||
elsif($testnum< 400) {
|
elsif($testnum< 400) {
|
||||||
# 300 - 399 is for HTTPS, two servers!
|
# 300 - 399 is for HTTPS, two servers!
|
||||||
|
push @what, "http";
|
||||||
if(!$checkstunnel || !$ssl_version) {
|
push @what, "https";
|
||||||
# we can't run https tests without stunnel
|
|
||||||
# or if libcurl is SSL-less
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$run{'http'}) {
|
|
||||||
runhttpserver($verbose);
|
|
||||||
$run{'http'}=$HTTPPIDFILE;
|
|
||||||
}
|
|
||||||
if(!$run{'https'}) {
|
|
||||||
runhttpsserver($verbose);
|
|
||||||
$run{'https'}=$HTTPSPIDFILE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elsif($testnum< 500) {
|
elsif($testnum< 500) {
|
||||||
# 400 - 499 is for FTPS, also two servers
|
# 400 - 499 is for FTPS, also two servers
|
||||||
|
push @what, "ftp";
|
||||||
|
push @what, "ftps";
|
||||||
|
}
|
||||||
|
|
||||||
if(!$checkstunnel || !$ssl_version) {
|
if(!@what) {
|
||||||
# we can't run https tests without stunnel
|
# load the test case file definition
|
||||||
# or if libcurl is SSL-less
|
if(loadtest("${TESTDIR}/test${testnum}")) {
|
||||||
return 1;
|
if($verbose) {
|
||||||
|
# this is not a test
|
||||||
|
print "$testnum doesn't look like a test case!\n";
|
||||||
|
}
|
||||||
|
return 100;
|
||||||
}
|
}
|
||||||
if(!$run{'ftp'}) {
|
@what = getpart("client", "server");
|
||||||
runftpserver($verbose);
|
|
||||||
$run{'ftp'}=$FTPPIDFILE;
|
if(!$what[0]) {
|
||||||
}
|
warn "Test case $testnum has no server(s) specified!";
|
||||||
if(!$run{'ftps'}) {
|
return 100;
|
||||||
runftpsserver($verbose);
|
|
||||||
$run{'ftps'}=$FTPSPIDFILE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
for(@what) {
|
||||||
print "Bad test number, no server available\n";
|
my $what = lc($_);
|
||||||
return 100;
|
$what =~ s/[^a-z]//g;
|
||||||
|
if($what eq "ftp") {
|
||||||
|
if(!$run{'ftp'}) {
|
||||||
|
runftpserver($verbose);
|
||||||
|
$run{'ftp'}=$FTPPIDFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($what eq "http") {
|
||||||
|
if(!$run{'http'}) {
|
||||||
|
runhttpserver($verbose);
|
||||||
|
$run{'http'}=$HTTPPIDFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($what eq "ftps") {
|
||||||
|
if(!$checkstunnel || !$ssl_version) {
|
||||||
|
# we can't run https tests without stunnel
|
||||||
|
# or if libcurl is SSL-less
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(!$run{'ftps'}) {
|
||||||
|
runftpsserver($verbose);
|
||||||
|
$run{'ftps'}=$FTPSPIDFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($what eq "file") {
|
||||||
|
# we support it but have no server!
|
||||||
|
}
|
||||||
|
elsif($what eq "https") {
|
||||||
|
if(!$checkstunnel || !$ssl_version) {
|
||||||
|
# we can't run https tests without stunnel
|
||||||
|
# or if libcurl is SSL-less
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(!$run{'https'}) {
|
||||||
|
runhttpsserver($verbose);
|
||||||
|
$run{'https'}=$HTTPSPIDFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
warn "we don't support a server for $what";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep 1; # give a second for the server(s) to startup
|
sleep 1; # give a second for the server(s) to startup
|
||||||
return 0; # ok
|
return 0; # ok
|
||||||
|
Loading…
Reference in New Issue
Block a user