--- runtests.pl.orig Tue Apr 2 14:09:00 2002 +++ runtests.pl Wed May 22 10:27:30 2002 @@ -7,6 +7,7 @@ # These should be the only variables that might be needed to get edited: use strict; +use warnings; @INC=(@INC, $ENV{'srcdir'}, "."); @@ -20,6 +21,7 @@ my $FTPPORT=8921; # this is the FTP server port my $FTPSPORT=8821; # this is the FTPS server port my $CURL="../src/curl"; # what curl executable to run on the tests +my $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging my $LOGDIR="log"; my $TESTDIR="data"; my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server @@ -48,6 +50,11 @@ # this gets set if curl is compiled with memory debugging: my $memory_debug=0; +# this gets set if curl is compiled with netrc debugging: +# It has to be in the global symbol table because of the way 'requires' works +$main::netrc_debug=0; +my $netrc_debug = \$main::netrc_debug; + # name of the file that the memory debugging creates: my $memdump="memdump"; @@ -58,6 +65,8 @@ my $ssl_version; # set if libcurl is built with SSL support +my $skipped=0; # number of tests skipped; reported in main loop + ####################################################################### # variables the command line options may set # @@ -389,8 +398,14 @@ # enabled and we shall verify that no memory leaks exist # after each and every test! $memory_debug=1; + + # there's only one debug control in the configure script + # so hope netrc debugging is enabled and set it up + $$netrc_debug = 1; + $ENV{'CURL_DEBUG_NETRC'} = 'log/netrc'; } printf("* Memory debugging: %s\n", $memory_debug?"ON":"OFF"); + printf("* Netrc debugging: %s\n", $$netrc_debug?"ON":"OFF"); printf("* HTTPS server: %s\n", $checkstunnel?"ON":"OFF"); printf("* FTPS server: %s\n", $checkstunnel?"ON":"OFF"); printf("* libcurl SSL: %s\n", $ssl_version?"ON":"OFF"); @@ -398,6 +413,21 @@ } ####################################################################### +# substitute the variable stuff into either a joined up file or +# a command, in either case passed by reference +# +sub subVariables { + my ($thing) = @_; + $$thing =~ s/%HOSTIP/$HOSTIP/g; + $$thing =~ s/%HOSTPORT/$HOSTPORT/g; + $$thing =~ s/%HTTPSPORT/$HTTPSPORT/g; + $$thing =~ s/%FTPPORT/$FTPPORT/g; + $$thing =~ s/%FTPSPORT/$FTPSPORT/g; + $$thing =~ s/%SRCDIR/$srcdir/g; + $$thing =~ s/%PWD/$pwd/g; +} + +####################################################################### # Run a single specified test case # @@ -413,6 +443,27 @@ return -1; } + { + my %hash = getpartattr("client"); + my $requires = $hash{'requires'}; + + if (defined($requires)) { + no strict "refs"; + my $value=${$requires}; +# print "This test requires '$requires' with value '$value' \n"; + + if (${$requires}) { + # this test is OK + ; + }else { + print "$testnum requires $requires, which is not set; skipping\n"; + $skipped++; + return 0; # look successful + } + } + } + + # extract the reply data my @reply = getpart("reply", "data"); my @replycheck = getpart("reply", "datacheck"); @@ -470,13 +521,16 @@ # make some nice replace operations $cmd =~ s/\n//g; # no newlines please - $cmd =~ s/%HOSTIP/$HOSTIP/g; - $cmd =~ s/%HOSTPORT/$HOSTPORT/g; - $cmd =~ s/%HTTPSPORT/$HTTPSPORT/g; - $cmd =~ s/%FTPPORT/$FTPPORT/g; - $cmd =~ s/%FTPSPORT/$FTPSPORT/g; - $cmd =~ s/%SRCDIR/$srcdir/g; - $cmd =~ s/%PWD/$pwd/g; + + subVariables \$cmd; + +# $cmd =~ s/%HOSTIP/$HOSTIP/g; +# $cmd =~ s/%HOSTPORT/$HOSTPORT/g; +# $cmd =~ s/%HTTPSPORT/$HTTPSPORT/g; +# $cmd =~ s/%FTPPORT/$FTPPORT/g; +# $cmd =~ s/%FTPSPORT/$FTPSPORT/g; +# $cmd =~ s/%SRCDIR/$srcdir/g; +# $cmd =~ s/%PWD/$pwd/g; #$cmd =~ s/%HOSTNAME/$HOSTNAME/g; @@ -490,18 +544,24 @@ my %hash = getpartattr("client", "file"); my $filename=$hash{'name'}; + if(!$filename) { print "ERROR: section client=>file has no name attribute!\n"; exit; } - writearray($filename, \@inputfile); + my $fileContent = join('', @inputfile); + subVariables \$fileContent; +# print "DEBUG: writing file " . $filename . "\n"; + open OUTFILE, ">$filename"; + print OUTFILE $fileContent; + close OUTFILE; } my %cmdhash = getpartattr("client", "command"); my $out=""; - if($cmdhash{'option'} eq "no-output") { + if(defined($cmdhash{'option'}) && $cmdhash{'option'} eq "no-output") { #print "*** We don't slap on --output\n"; } else { @@ -536,7 +596,7 @@ print GDBCMD "set args $cmdargs\n"; print GDBCMD "show args\n"; close(GDBCMD); - system("gdb $CURL -x log/gdbcmd"); + system("gdb $DBGCURL -x log/gdbcmd"); $res =0; # makes it always continue after a debugged run } else { @@ -786,7 +846,7 @@ my $number=0; my $fromnum=-1; my @testthis; -do { +while (defined($ARGV[0])) { if ($ARGV[0] eq "-v") { # verbose output $verbose=1; @@ -852,7 +912,8 @@ elsif($ARGV[0] =~ /^to$/i) { $fromnum = $number+1; } -} while(shift @ARGV); + shift @ARGV; +} if($testthis[0] ne "") { $TESTCASES=join(" ", @testthis); @@ -908,7 +969,6 @@ my $testnum; my $ok=0; my $total=0; -my $skipped=0; foreach $testnum (split(" ", $TESTCASES)) {