Newer
Older
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://curl.haxx.se/docs/copyright.html.
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# $Id$
###########################################################################
# These should be the only variables that might be needed to get edited:
#use Time::HiRes qw( gettimeofday );
@INC=(@INC, $ENV{'srcdir'}, ".");
require "getpart.pm"; # array functions
require "valgrind.pm"; # valgrind report parser
Daniel Stenberg
committed
require "ftp.pm";
Daniel Stenberg
committed
my $srcdir = $ENV{'srcdir'} || '.';
Daniel Stenberg
committed
my $base = 8990; # base port number
my $HTTPPORT; # HTTP server port
my $HTTP6PORT; # HTTP IPv6 server port
Daniel Stenberg
committed
my $HTTPSPORT; # HTTPS server port
my $FTPPORT; # FTP server port
Daniel Stenberg
committed
my $FTP2PORT; # FTP server 2 port
Daniel Stenberg
committed
my $FTPSPORT; # FTPS server port
Daniel Stenberg
committed
my $FTP6PORT; # FTP IPv6 server port
my $TFTPPORT; # TFTP
my $TFTP6PORT; # TFTP
Daniel Stenberg
committed
my $CURL="../src/curl"; # what curl executable to run on the tests
my $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging
my $TESTDIR="$srcdir/data";
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
Daniel Stenberg
committed
my $SERVER2IN="$LOGDIR/server2.input"; # what curl sent the second server
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
# Normally, all test cases should be run, but at times it is handy to
# simply run a particular one:
# To run specific test cases, set them like:
# $TESTCASES="1 2 3 7 8";
#######################################################################
# No variables below this point should need to be modified
#
my $HTTPPIDFILE=".http.pid";
my $HTTP6PIDFILE=".http6.pid";
my $FTPPIDFILE=".ftp.pid";
Daniel Stenberg
committed
my $FTP6PIDFILE=".ftp6.pid";
Daniel Stenberg
committed
my $FTP2PIDFILE=".ftp2.pid";
my $FTPSPIDFILE=".ftps.pid";
my $TFTPPIDFILE=".tftpd.pid";
my $TFTP6PIDFILE=".tftp6.pid";
# invoke perl like this:
my $perl="perl -I$srcdir";
Daniel Stenberg
committed
my $server_response_maxtime=13;
# this gets set if curl is compiled with debugging:
my $curl_debug=0;
my $libtool;
# name of the file that the memory debugging creates:
my $memdump="$LOGDIR/memdump";
# the path to the script that analyzes the memory debug output file:
my $memanalyze="./memanalyze.pl";
Daniel Stenberg
committed
my $stunnel = checkcmd("stunnel4") || checkcmd("stunnel");
my $valgrind = checkcmd("valgrind");
Daniel Stenberg
committed
my $valgrind_logfile="--logfile";
my $start;
Daniel Stenberg
committed
my $forkserver=0;
Daniel Stenberg
committed
my $ftpchecktime; # time it took to verify our test FTP server
my $valgrind_tool;
if($valgrind) {
# since valgrind 2.1.x, '--tool' option is mandatory
# use it, if it is supported by the version installed on the system
system("valgrind --help 2>&1 | grep -- --tool > /dev/null 2>&1");
if (($? >> 8)==0) {
$valgrind_tool="--tool=memcheck ";
}
open(C, "<$CURL");
my $l = <C>;
if($l =~ /^\#\!/) {
# The first line starts with "#!" which implies a shell-script.
# This means libcurl is built shared and curl is a wrapper-script
# Disable valgrind in this setup
$valgrind=0;
}
close(C);
Daniel Stenberg
committed
# valgrind 3 renamed the --logfile option to --log-file!!!
my $ver=`valgrind --version`;
# cut off all but digits and dots
$ver =~ s/[^0-9.]//g;
if($ver >= 3) {
$valgrind_logfile="--log-file";
}
Daniel Stenberg
committed
my $gdb = checkcmd("gdb");
Daniel Stenberg
committed
my $ssl_version; # set if libcurl is built with SSL support
my $large_file; # set if libcurl is built with large file support
Daniel Stenberg
committed
my $has_idn; # set if libcurl is built with IDN support
my $http_ipv6; # set if HTTP server has IPv6 support
Daniel Stenberg
committed
my $ftp_ipv6; # set if FTP server has IPv6 support
my $tftp_ipv6; # set if TFTP server has IPv6 support
my $has_ipv6; # set if libcurl is built with IPv6 support
my $has_libz; # set if libcurl is built with libz support
my $has_getrlimit; # set if system has getrlimit()
Daniel Stenberg
committed
my $has_ntlm; # set if libcurl is built with NTLM support
my $has_openssl; # set if libcurl is built with OpenSSL
my $has_gnutls; # set if libcurl is built with GnuTLS
my $has_textaware; # set if running on a system that has a text mode concept
# on files. Windows for example
Daniel Stenberg
committed
Daniel Stenberg
committed
my $skipped=0; # number of tests skipped; reported in main loop
my %skipped; # skipped{reason}=counter, reasons for skip
my @teststat; # teststat[testnum]=reason, reasons for skip
#######################################################################
# variables the command line options may set
#
my $short;
my $verbose;
my $debugprotocol;
my $gdbthis; # run test case with gdb debugger
my $keepoutfiles; # keep stdout and stderr files after tests
Daniel Stenberg
committed
my $postmortem; # display detailed info about failed tests
my $pwd; # current working directory
# torture test variables
my $torture;
my $tortnum;
my $tortalloc;
# open and close each time to allow removal at any time
sub logmsg {
# uncomment the Time::HiRes usage for this
# my ($seconds, $microseconds) = gettimeofday;
# my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
# localtime($seconds);
my $t;
if(1) {
# $t = sprintf ("%02d:%02d:%02d.%06d ", $hour, $min, $sec,
# $microseconds);
}
for(@_) {
print "${t}$_";
}
}
chomp($pwd = `pwd`);
# enable memory debugging if curl is compiled with it
$ENV{'CURL_MEMDEBUG'} = $memdump;
Daniel Stenberg
committed
$ENV{'HOME'}=$pwd;
sub catch_zap {
my $signame = shift;
logmsg "runtests.pl received SIG$signame, exiting\n";
stopservers(1);
Loading
Loading full blame…