my ($testcmd, $testnum, $gdbline) = @_;
# remove memdump first to be sure we get a new nice and clean one
- unlink($memdump);
+ unlink("$LOGDIR/$MEMDUMP");
# First get URL from test server, ignore the output/result
runclient($testcmd);
# memanalyze -v is our friend, get the number of allocations made
my $count=0;
- my @out = `$memanalyze -v $memdump`;
+ my @out = `$memanalyze -v "$LOGDIR/$MEMDUMP"`;
for(@out) {
if(/^Operations: (\d+)/) {
$count = $1;
$ENV{'CURL_MEMLIMIT'} = $limit;
# remove memdump first to be sure we get a new nice and clean one
- unlink($memdump);
+ unlink("$LOGDIR/$MEMDUMP");
my $cmd = $testcmd;
if($valgrind && !$gdbthis) {
$fail=1;
}
else {
- my @memdata=`$memanalyze $memdump`;
+ my @memdata=`$memanalyze "$LOGDIR/$MEMDUMP"`;
my $leak=0;
for(@memdata) {
if($_ ne "") {
if($leak) {
logmsg "** MEMORY FAILURE\n";
logmsg @memdata;
- logmsg `$memanalyze -l $memdump`;
+ logmsg `$memanalyze -l "$LOGDIR/$MEMDUMP"`;
$fail = 1;
}
}
my ($testnum, $testtimings) = @_;
# remove old test server files before servers are started/verified
- unlink($FTPDCMD);
- unlink($SERVERIN);
- unlink($SERVER2IN);
- unlink($PROXYIN);
+ unlink("$LOGDIR/$FTPDCMD");
+ unlink("$LOGDIR/$SERVERIN");
+ unlink("$LOGDIR/$PROXYIN");
# timestamp required servers verification start
$$testtimings{"timesrvrini"} = Time::HiRes::time();
my ($testnum) = @_;
if($feature{"TrackMemory"}) {
- unlink($memdump);
+ unlink("$LOGDIR/$MEMDUMP");
}
unlink("core");
# remove server output logfiles after servers are started/verified
- unlink($SERVERIN);
- unlink($SERVER2IN);
- unlink($PROXYIN);
+ unlink("$LOGDIR/$SERVERIN");
+ unlink("$LOGDIR/$PROXYIN");
# if this section exists, it might be FTP server instructions:
my @ftpservercmd = getpart("reply", "servercmd");
push @ftpservercmd, "Testnum $testnum\n";
# write the instructions to file
- writearray($FTPDCMD, \@ftpservercmd);
+ writearray("$LOGDIR/$FTPDCMD", \@ftpservercmd);
# create (possibly-empty) files before starting the test
for my $partsuffix (('', '1', '2', '3', '4')) {
}
# enable memory debugging if curl is compiled with it
-$ENV{'CURL_MEMDEBUG'} = $memdump;
+$ENV{'CURL_MEMDEBUG'} = "$LOGDIR/$MEMDUMP";
$ENV{'CURL_ENTROPY'}="12345678";
$ENV{'CURL_FORCETIME'}=1; # for debug NTLM magic
$ENV{'CURL_GLOBAL_INIT'}=1; # debug curl_global_init/cleanup use
return 0; # can't open dir
while($file = readdir($dh)) {
# Don't clear the $PIDDIR since those need to live beyond one test
- if(($file !~ /^(\.|\.\.)\z/) && "$dir/$file" ne $PIDDIR) {
+ if(($file !~ /^(\.|\.\.)\z/) && "$file" ne $PIDDIR) {
if(-d "$dir/$file") {
if(!cleardir("$dir/$file")) {
$done = 0;
my @protocol= getpart("verify", "protocol");
if(@protocol) {
# Verify the sent request
- my @out = loadarray($SERVERIN);
+ my @out = loadarray("$logdir/$SERVERIN");
# check if there's any attributes on the verify/protocol section
my %hash = getpartattr("verify", "protocol");
if((!$out[0] || ($out[0] eq "")) && $protocol[0]) {
logmsg "\n $testnum: protocol FAILED!\n".
- " There was no content at all in the file $SERVERIN.\n".
+ " There was no content at all in the file $logdir/$SERVERIN.\n".
" Server glitch? Total curl failure? Returned: $cmdres\n";
# timestamp test result verification end
$timevrfyend{$testnum} = Time::HiRes::time();
chomp($proxyprot[-1]);
}
- my @out = loadarray($PROXYIN);
+ my @out = loadarray("$logdir/$PROXYIN");
for(@strip) {
# strip off all lines that match the patterns from both arrays
chomp $_;
}
if($feature{"TrackMemory"}) {
- if(! -f $memdump) {
+ if(! -f "$logdir/$MEMDUMP") {
my %cmdhash = getpartattr("client", "command");
my $cmdtype = $cmdhash{'type'} || "default";
logmsg "\n** ALERT! memory tracking with no output file?\n"
if(!$cmdtype eq "perl");
}
else {
- my @memdata=`$memanalyze $memdump`;
+ my @memdata=`$memanalyze "$logdir/$MEMDUMP"`;
my $leak=0;
for(@memdata) {
if($_ ne "") {
cleardir($LOGDIR);
mkdir($LOGDIR, 0777);
-mkdir($PIDDIR, 0777);
+mkdir("$LOGDIR/$PIDDIR", 0777);
#######################################################################
# initialize some variables
#
if(!$listonly) {
- unlink($memdump); # remove this if there was one left
+ unlink("$LOGDIR/$MEMDUMP"); # remove this if there was one left
checksystemfeatures();
}
#######################################################################
# Initialize configuration variables
sub initserverconfig {
- $SOCKSUNIXPATH = "$PIDDIR/socks.sock"; # SOCKS server Unix domain socket path
- $HTTPUNIXPATH = "$PIDDIR/http.sock"; # HTTP server Unix domain socket path
+ $SOCKSUNIXPATH = "$LOGDIR/$PIDDIR/socks.sock"; # SOCKS Unix domain socket
+ $HTTPUNIXPATH = "$LOGDIR/$PIDDIR/http.sock"; # HTTP Unix domain socket
$stunnel = checkcmd("stunnel4") || checkcmd("tstunnel") || checkcmd("stunnel");
# get the name of the current user
for my $ipvnum ((4, 6)) {
for my $idnum ((1, 2, 3)) {
my $serv = servername_id("$proto$ssl", $ipvnum, $idnum);
- my $pidf = server_pidfilename($PIDDIR, "$proto$ssl", $ipvnum, $idnum);
+ my $pidf = server_pidfilename("$LOGDIR/$PIDDIR", "$proto$ssl",
+ $ipvnum, $idnum);
$serverpidfile{$serv} = $pidf;
- my $portf = server_portfilename($PIDDIR, "$proto$ssl", $ipvnum, $idnum);
+ my $portf = server_portfilename("$LOGDIR/$PIDDIR", "$proto$ssl",
+ $ipvnum, $idnum);
$serverportfile{$serv} = $portf;
}
}
for my $ipvnum ((4, 6)) {
for my $idnum ((1, 2)) {
my $serv = servername_id($proto, $ipvnum, $idnum);
- my $pidf = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
+ my $pidf = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum,
+ $idnum);
$serverpidfile{$serv} = $pidf;
- my $portf = server_portfilename($PIDDIR, $proto, $ipvnum, $idnum);
+ my $portf = server_portfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum,
+ $idnum);
$serverportfile{$serv} = $portf;
}
}
for my $proto (('http', 'imap', 'pop3', 'smtp', 'http/2', 'http/3')) {
for my $ssl (('', 's')) {
my $serv = servername_id("$proto$ssl", "unix", 1);
- my $pidf = server_pidfilename($PIDDIR, "$proto$ssl", "unix", 1);
+ my $pidf = server_pidfilename("$LOGDIR/$PIDDIR", "$proto$ssl",
+ "unix", 1);
$serverpidfile{$serv} = $pidf;
- my $portf = server_portfilename($PIDDIR, "$proto$ssl", "unix", 1);
+ my $portf = server_portfilename("$LOGDIR/$PIDDIR", "$proto$ssl",
+ "unix", 1);
$serverportfile{$serv} = $portf;
}
}
my $proto = $1;
my $idnum = ($2 && ($2 > 1)) ? $2 : 1;
my $ipvnum = ($3 && ($3 =~ /6$/)) ? 6 : 4;
- killsockfilters($PIDDIR, $proto, $ipvnum, $idnum, $verbose);
+ killsockfilters("$LOGDIR/$PIDDIR", $proto, $ipvnum, $idnum, $verbose);
}
#
# All servers relative to the given one must be stopped also
#
sub verifyssh {
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
- my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
+ my $pidfile = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum,
+ $idnum);
my $pid = processexists($pidfile);
if($pid < 0) {
logmsg "RUN: SSH server has died after starting up\n";
}
# Connect to sftp server, authenticate and run a remote pwd
# command using our generated configuration and key files
- my $cmd = "\"$sftp\" -b $PIDDIR/$sftpcmds -F $PIDDIR/$sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1";
+ my $cmd = "\"$sftp\" -b $LOGDIR/$PIDDIR/$sftpcmds -F $LOGDIR/$PIDDIR/$sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1";
my $res = runclient($cmd);
# Search for pwd command response in log file
if(open(my $sftplogfile, "<", "$sftplog")) {
sub verifyhttptls {
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
my $server = servername_id($proto, $ipvnum, $idnum);
- my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
+ my $pidfile = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum,
+ $idnum);
my $verifyout = "$LOGDIR/".
servername_canon($proto, $ipvnum, $idnum) .'_verify.out';
#
sub verifysocks {
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
- my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
+ my $pidfile = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum,
+ $idnum);
my $pid = processexists($pidfile);
if($pid < 0) {
logmsg "RUN: SOCKS server has died after starting up\n";
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
$flags .= "--logdir \"$LOGDIR\" ";
$flags .= "--portfile $portfile ";
- $flags .= "--config $FTPDCMD ";
+ $flags .= "--config $LOGDIR/$FTPDCMD ";
$flags .= "--id $idnum " if($idnum > 1);
if($ipvnum eq "unix") {
$flags .= "--unix-socket '$port_or_path' ";
}
my $hostfile;
- if(!open($hostfile, "<", $PIDDIR . "/" . $hstpubmd5f) ||
+ if(!open($hostfile, "<", "$LOGDIR/$PIDDIR/$hstpubmd5f") ||
(read($hostfile, $SSHSRVMD5, 32) != 32) ||
!close($hostfile) ||
($SSHSRVMD5 !~ /^[a-f0-9]{32}$/i))
die $msg;
}
- if(!open($hostfile, "<", $PIDDIR . "/" . $hstpubsha256f) ||
+ if(!open($hostfile, "<", "$LOGDIR/$PIDDIR/$hstpubsha256f") ||
(read($hostfile, $SSHSRVSHA256, 48) == 0) ||
!close($hostfile))
{
" --port 0 ".
" --pidfile $pidfile".
" --portfile $portfile".
- " --config $FTPDCMD".
+ " --config $LOGDIR/$FTPDCMD".
" --logfile $logfile".
" --logdir $LOGDIR";
my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0);
" --logfile $logfile".
" --unix-socket $SOCKSUNIXPATH".
" --backend $HOSTIP".
- " --config $FTPDCMD";
+ " --config $LOGDIR/$FTPDCMD";
} else {
$cmd="server/socksd".exe_ext('SRV').
" --port 0 ".
" --reqfile $LOGDIR/$SOCKSIN".
" --logfile $logfile".
" --backend $HOSTIP".
- " --config $FTPDCMD";
+ " --config $LOGDIR/$FTPDCMD";
}
my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0);
#
# kill sockfilter processes for all pingpong servers
#
- killallsockfilters($PIDDIR, $verb);
+ killallsockfilters("$LOGDIR/$PIDDIR", $verb);
#
# kill all server pids from %run hash clearing them
#