my $salist = 0;
my $copyright;
my $spdx;
- open(F, "<:crlf", "$f") ||
+ open(F, "<:crlf", $f) ||
return 1;
while(<F>) {
$line++;
my $title;
if(defined($f)) {
- if(!open($fh, "<:crlf", "$f")) {
+ if(!open($fh, "<:crlf", $f)) {
print STDERR "cd2nroff failed to open '$f' for reading: $!\n";
return 1;
}
closedir $dh;
for my $cd (@cd) {
- my $nroff = "$cd";
+ my $nroff = $cd;
$nroff =~ s/\.md\z/.3/;
print "$dir/$cd = $dir/$nroff\n";
system('./scripts/cd2nroff', ('-d', $dir, "$dir/$cd"));
readlocalfile($file);
do {
- if("$wlist" !~ / $file /) {
+ if($wlist !~ / $file /) {
my $fullname = $file;
$fullname = "$dir/$file" if($fullname !~ '^\.?\.?/');
scanfile($fullname);
# number of setops:
sub setopts {
my ($f)=@_;
- open(H, "$f");
+ open(H, $f);
my $opts;
while(<H>) {
if(/^ CURLOPT(|DEPRECATED)\(/ && ($_ !~ /OBSOLETE/)) {
sub findlinks {
my ($f) = @_;
my $line = 1;
- open(F, "<:crlf", "$f") ||
+ open(F, "<:crlf", $f) ||
return;
# is it a markdown extension?
print "\t-b\tbackup an existing version of ca-bundle.crt\n";
print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
print "\t\t Valid names are:\n";
- print "\t\t ", join(", ", map { ($_ =~ m/$opt_d/) ? "$_ (default)" : "$_" } sort keys %urls), "\n";
+ print "\t\t ", join(", ", map { ($_ =~ m/$opt_d/) ? "$_ (default)" : $_ } sort keys %urls), "\n";
print "\t-f\tforce rebuild even if certdata.txt is current\n";
print "\t-i\tprint version info about used modules\n";
print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n";
my $cka_value;
my $valid = 0;
-open(TXT,"$txt") or die "Could not open $txt: $!\n";
+open(TXT, $txt) or die "Could not open $txt: $!\n";
while(<TXT>) {
if(/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) {
print CRT;
sub single {
my ($f)=@_;
- open(F, "<:crlf", "$f") ||
+ open(F, "<:crlf", $f) ||
return 1;
my $line;
my $title;
# remove leading directory
$f =~ s/(.*?\/)//;
close(F);
- open(F, "<:crlf", "$f") || return 1;
+ open(F, "<:crlf", $f) || return 1;
}
if($d =~ /^\.TH ([^ ]*) (\d) \"(.*?)\" ([^ \n]*)/) {
# header, this needs to be the first thing after leading comments
# use \r\n for WSL shell
$line =~ s/\r?\n$/\r\n/g;
}
- print "$line";
+ print $line;
}
}
for my $am (@auth_mechs) {
if(!$mechs) {
- $mechs = "$am";
+ $mechs = $am;
}
else {
$mechs .= " $am";
logmsg "Store test number $testno in $filename\n";
- open(my $file, ">", "$filename") ||
+ open(my $file, ">", $filename) ||
return 0; # failed to open output
my $line;
logmsg "Store test number $testno in $filename\n";
- open(my $file, ">", "$filename") ||
+ open(my $file, ">", $filename) ||
return 0; # failed to open output
my $received = 0;
for my $am (@auth_mechs) {
if(!$mechs) {
- $mechs = "$am";
+ $mechs = $am;
}
else {
$mechs .= " $am";
sendcontrol "125 Gimme gimme gimme!\r\n";
- open(my $file, ">", "$filename") ||
+ open(my $file, ">", $filename) ||
return 0; # failed to open output
my $line;
$str = 'NODATACONN425' if($nodataconn425);
$str = 'NODATACONN421' if($nodataconn421);
$str = 'NODATACONN150' if($nodataconn150);
- return "$str";
+ return $str;
}
#**********************************************************************
$srvrname = servername_str($proto, $ipvnum, $idnum);
$serverlogs_lockfile = "$logdir/$LOCKDIR/${srvrname}.lock";
-$idstr = "$idnum" if($idnum > 1);
+$idstr = $idnum if($idnum > 1);
protocolsetup($proto);
# actual port
if($portfile && !$port) {
my $aport;
- open(my $p, "<", "$portfile");
+ open(my $p, "<", $portfile);
$aport = <$p>;
close($p);
$port = 0 + $aport;
logmsg sprintf("%s server listens on port IPv${ipvnum}/${port}\n", uc($proto));
-open(my $pid, ">", "$pidfile");
+open(my $pid, ">", $pidfile);
print $pid $$."\n";
close($pid);
undef @xml;
$xmlfile = "";
- if(open(my $xmlh, "<", "$file")) {
+ if(open(my $xmlh, "<", $file)) {
if($original) {
binmode $xmlh, ':crlf';
}
sub savetest {
my ($file)=@_;
- if(open(my $xmlh, ">", "$file")) {
+ if(open(my $xmlh, ">", $file)) {
binmode $xmlh; # for crapage systems, use binary
for(@xml) {
print $xmlh $_;
sub writearray {
my ($filename, $arrayref)=@_;
- open(my $temp, ">", "$filename") || die "Failure writing file";
+ open(my $temp, ">", $filename) || die "Failure writing file";
binmode($temp,":raw"); # Cygwin fix
for(@$arrayref) {
print $temp $_;
my ($filename)=@_;
my @array;
- if(open(my $temp, "<", "$filename")) {
+ if(open(my $temp, "<", $filename)) {
while(<$temp>) {
push @array, $_;
}
$memsum = 0; # the total number of memory allocated over the lifetime
$maxmem = 0; # the high water mark
- open(my $fileh, "<", "$file") or return ();
+ open(my $fileh, "<", $file) or return ();
if($showlimit) {
while(<$fileh>) {
my $waits = 0;
# wait at max 15 seconds for the file to exist and have valid content
while(!$pid && ($waits <= ($timeout_sec * 10))) {
- if(-f $pidfile && -s $pidfile && open(my $pidfh, "<", "$pidfile")) {
+ if(-f $pidfile && -s $pidfile && open(my $pidfh, "<", $pidfile)) {
$pid = 0 + <$pidfh>;
close($pidfh);
$pid = 0 if($pid < 0);
my $filter = "PID eq $pid";
# https://ss64.com/nt/tasklist.html
my $result = `tasklist -fi \"$filter\" 2>$dev_null`;
- if(index($result, "$pid") != -1) {
+ if(index($result, $pid) != -1) {
return -$pid;
}
}
my ($filename) = @_;
my $fileh;
- if(open($fileh, ">", "$filename") && close($fileh)) {
+ if(open($fileh, ">", $filename) && close($fileh)) {
return;
}
printf "Error creating lock file $filename error: $!\n";
#
sub checktestcmd {
my ($cmd)=@_;
- my @testpaths=($LIBDIR . ".libs", "$LIBDIR");
+ my @testpaths=($LIBDIR . ".libs", $LIBDIR);
return checkcmd($cmd, @testpaths);
}
@entiretest = prepro($testnum, @entiretest);
# save the new version
- open(my $fulltesth, ">", "$otest") || die "Failure writing test file";
+ open(my $fulltesth, ">", $otest) || die "Failure writing test file";
foreach my $bytes (@entiretest) {
print $fulltesth pack('a*', $bytes) or die "Failed to print '$bytes': $!";
}
if($content =~ /^=(.*)/) {
# assign it
$content = $1;
- $ENV{$var} = "$content";
+ $ENV{$var} = $content;
logmsg "setenv $var = $content\n" if($verbose);
}
else {
mkdir $d; # 0777
}
}
- if(open(my $outfile, ">", "$filename")) {
+ if(open(my $outfile, ">", $filename)) {
binmode $outfile; # for crapage systems, use binary
if($fileattr{'nonewline'}) {
my $fail_due_event_based = $run_event_based;
if($cmdtype eq "perl") {
# run the command line prepended with "perl"
- $cmdargs ="$cmd";
+ $cmdargs =$cmd;
$CMDLINE = "$perl ";
$tool=$CMDLINE;
$disablevalgrind=1;
}
elsif($cmdtype eq "shell") {
# run the command line prepended with "/bin/sh"
- $cmdargs ="$cmd";
+ $cmdargs =$cmd;
$CMDLINE = "/bin/sh ";
$tool=$CMDLINE;
$disablevalgrind=1;
}
else {
# Convert the raw result code into a more useful one
- ($cmdres, $dumped_core) = normalize_cmdres(runclient("$CMDLINE"));
+ ($cmdres, $dumped_core) = normalize_cmdres(runclient($CMDLINE));
}
# restore contents
chomp $cmd;
if($cmd) {
logmsg "postcheck $cmd\n" if($verbose);
- my $rc = runclient("$cmd");
+ my $rc = runclient($cmd);
# Must run the postcheck command in torture mode in order
# to clean up, but the result cannot be relied upon.
if($rc != 0 && !$torture) {
# use \r\n for WSL shell
$line =~ s/\r?\n$/\r\n/g;
}
- print "$line";
+ print $line;
}
}
# Do not clear the $PIDDIR or $LOCKDIR since those need to live beyond
# one test
if(($file !~ /^(\.|\.\.)\z/) &&
- "$file" ne $PIDDIR && "$file" ne $LOCKDIR) {
+ $file ne $PIDDIR && $file ne $LOCKDIR) {
if(-d "$dir/$file") {
if(!cleardir("$dir/$file")) {
$done = 0;
}
else {
# Ignore stunnel since we cannot do anything about its locks
- if(!unlink("$dir/$file") && "$file" !~ /_stunnel\.log$/) {
+ if(!unlink("$dir/$file") && $file !~ /_stunnel\.log$/) {
$done = 0;
}
}
my $file1="$logdir/check-generated";
my $file2="$logdir/check-expected";
- open(my $temp, ">", "$file1") || die "Failure writing diff file";
+ open(my $temp, ">", $file1) || die "Failure writing diff file";
for(@$firstref) {
my $l = $_;
$l =~ s/\r/[CR]/g;
}
close($temp) || die "Failure writing diff file";
- open($temp, ">", "$file2") || die "Failure writing diff file";
+ open($temp, ">", $file2) || die "Failure writing diff file";
for(@$secondref) {
my $l = $_;
$l =~ s/\r/[CR]/g;
$ENV{'SOURCE_DATE_EPOCH'} = $current_time;
$DATE = strftime "%Y-%m-%d", gmtime($current_time);
- open(my $versout, "<", "$curlverout");
+ open(my $versout, "<", $curlverout);
@version = <$versout>;
close($versout);
logmsg sprintf("command exited with value %d \n", $versretval >> 8);
}
logmsg "contents of $curlverout: \n";
- displaylogcontent("$curlverout");
+ displaylogcontent($curlverout);
logmsg "contents of $curlvererr: \n";
- displaylogcontent("$curlvererr");
+ displaylogcontent($curlvererr);
die "Could not get curl's version";
}
my $loadfile = $hash{'loadfile'};
if($loadfile) {
- open(my $tmp, "<", "$loadfile") || die "Cannot open file $loadfile: $!";
+ open(my $tmp, "<", $loadfile) || die "Cannot open file $loadfile: $!";
@validstdout = <$tmp>;
close($tmp);
}
if($valgrind) {
if($usedvalgrind) {
- if(!opendir(DIR, "$logdir")) {
+ if(!opendir(DIR, $logdir)) {
logmsg "ERROR: unable to read $logdir\n";
# timestamp test result verification end
$timevrfyend{$testnum} = Time::HiRes::time();
if(($? >> 8)) {
$valgrind_tool="";
}
- open(my $curlh, "<", "$CURL");
+ open(my $curlh, "<", $CURL);
my $l = <$curlh>;
if($l =~ /^\#\!/) {
# A shell script. This is typically when built with libtool,
if($gdbthis) {
# open the executable curl and read the first 4 bytes of it
- open(my $check, "<", "$CURL");
+ open(my $check, "<", $CURL);
my $c;
sysread $check, $c, 4;
close($check);
my ($file) = @_;
my @input;
- if(open(my $disabledh, "<", "$file")) {
+ if(open(my $disabledh, "<", $file)) {
while(<$disabledh>) {
if(/^ *\#/) {
# allow comments
# and excessively long files are elided
sub displaylogcontent {
my ($file)=@_;
- if(open(my $single, "<", "$file")) {
+ if(open(my $single, "<", $file)) {
my $linecount = 0;
my $truncate;
my @tail;
sub displaylogs {
my ($runnerid, $testnum)=@_;
my $logdir = getrunnerlogdir($runnerid);
- opendir(DIR, "$logdir") ||
+ opendir(DIR, $logdir) ||
die "cannot open dir: $!";
my @logs = readdir(DIR);
closedir(DIR);
# Find out version info for the given stunnel binary
#
foreach my $veropt (('-version', '-V')) {
- foreach my $verstr (qx("$stunnel" $veropt 2>&1)) {
+ foreach my $verstr (qx($stunnel $veropt 2>&1)) {
if($verstr =~ /^stunnel (\d+)\.(\d+) on /) {
$ver_major = $1;
$ver_minor = $2;
last if($ver_major);
}
if((!$ver_major) || !defined($ver_minor)) {
- if(-x "$stunnel" && ! -d "$stunnel") {
+ if(-x $stunnel && ! -d $stunnel) {
print "$ssltext Unknown stunnel version\n";
}
else {
$SIG{INT} = \&exit_signal_handler;
$SIG{TERM} = \&exit_signal_handler;
# stunnel configuration file
- if(open(my $stunconf, ">", "$conffile")) {
+ if(open(my $stunconf, ">", $conffile)) {
print $stunconf "cert = $certfile\n";
print $stunconf "debug = $loglevel\n";
print $stunconf "socket = $socketopt\n";
print uc($proto) ." server (stunnel $ver_major.$ver_minor)\n";
print "cmd: $cmd\n";
print "stunnel config at $conffile:\n";
- open (my $writtenconf, '<', "$conffile") or die "$ssltext could not open the config file after writing\n";
+ open (my $writtenconf, '<', $conffile) or die "$ssltext could not open the config file after writing\n";
print <$writtenconf>;
print "\n";
close ($writtenconf);
#
if($tstunnel_windows) {
# Fake pidfile for tstunnel on Windows.
- if(open(my $out, ">", "$pidfile")) {
+ if(open(my $out, ">", $pidfile)) {
print $out $$ . "\n";
close($out);
}
# we see warnings on Windows run that $logfile is used uninitialized
# TODO: not found yet where this comes from
$logfile = "serverhelp_uninitialized.log" if(!$logfile);
- if(open(my $logfilefh, ">>", "$logfile")) {
+ if(open(my $logfilefh, ">>", $logfile)) {
print $logfilefh $now;
print $logfilefh @_;
close($logfilefh);
sub server_pidfilename {
my ($piddir, $proto, $ipver, $idnum) = @_;
my $trailer = '_server.pid';
- return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
sub server_portfilename {
my ($piddir, $proto, $ipver, $idnum) = @_;
my $trailer = '_server.port';
- return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
my ($logdir, $proto, $ipver, $idnum) = @_;
my $trailer = '_server.log';
$trailer = '_stunnel.log' if(lc($proto) =~ /^(ftp|http|imap|pop3|smtp)s$/);
- return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
sub server_cmdfilename {
my ($logdir, $proto, $ipver, $idnum) = @_;
my $trailer = '_server.cmd';
- return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
sub server_inputfilename {
my ($logdir, $proto, $ipver, $idnum) = @_;
my $trailer = '_server.input';
- return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
sub server_outputfilename {
my ($logdir, $proto, $ipver, $idnum) = @_;
my $trailer = '_server.output';
- return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
die "unsupported protocol: '$proto'" unless($proto &&
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid' : '_sockfilt.pid';
- return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
die "unsupported protocol: '$proto'" unless($proto &&
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log' : '_sockfilt.log';
- return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
die "unsupported protocol: '$proto'" unless($proto &&
(lc($proto) =~ /^ftps?$/));
my $trailer = '_sockdata.pid';
- return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
die "unsupported protocol: '$proto'" unless($proto &&
(lc($proto) =~ /^ftps?$/));
my $trailer = '_sockdata.log';
- return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
+ return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer;
}
#***************************************************************************
# Ugly hack but ssh client and gnutls-serv do not support pid files
if($fakepidfile) {
- if(open(my $out, ">", "$pidfile")) {
+ if(open(my $out, ">", $pidfile)) {
print $out $child . "\n";
close($out) || die "Failure writing pidfile";
logmsg "startnew: $pidfile faked with pid=$child\n" if($verbose);
if($res && $verbose) {
logmsg "RUN: curl command returned $res\n";
- if(open(my $file, "<", "$verifylog")) {
+ if(open(my $file, "<", $verifylog)) {
while(my $string = <$file>) {
logmsg "RUN: $string" if($string !~ /^([ \t]*)$/);
}
}
my $data;
- if(open(my $file, "<", "$verifyout")) {
+ if(open(my $file, "<", $verifyout)) {
while(my $string = <$file>) {
$data = $string;
last; # only want first line
if($res && $verbose) {
logmsg "RUN: curl command returned $res\n";
- if(open(my $file, "<", "$verifylog")) {
+ if(open(my $file, "<", $verifylog)) {
while(my $string = <$file>) {
logmsg "RUN: $string" if($string !~ /^[ \t]*$/);
}
}
my $data;
- if(open(my $file, "<", "$verifyout")) {
+ if(open(my $file, "<", $verifyout)) {
while(my $string = <$file>) {
$data = $string;
last; # only want first line
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")) {
+ if(open(my $sftplogfile, "<", $sftplog)) {
while(<$sftplogfile>) {
if(/^Remote working directory: /) {
$verified = 1;
if($res && $verbose) {
logmsg "RUN: curl command returned $res\n";
- if(open(my $file, "<", "$verifylog")) {
+ if(open(my $file, "<", $verifylog)) {
while(my $string = <$file>) {
logmsg "RUN: $string" if($string !~ /^([ \t]*)$/);
}
}
my $data;
- if(open(my $file, "<", "$verifyout")) {
+ if(open(my $file, "<", $verifyout)) {
while(my $string = <$file>) {
$data .= $string;
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($httppid <= 0 || !pidexists($httppid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
$port = $port_or_path = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$port) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($http2pid <= 0 || !pidexists($http2pid)) {
# it is NOT alive
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
$http2pid = $pid2 = 0;
logmsg "RUN: failed to start the $srvrname server\n";
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($http3pid <= 0 || !pidexists($http3pid)) {
# it is NOT alive
- stopserver($server, "$pid3");
+ stopserver($server, $pid3);
$doesntrun{$pidfile} = 1;
$http3pid = $pid3 = 0;
logmsg "RUN: failed to start the $srvrname server\n";
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
sub runhttptlsserver {
my ($verb, $ipv6) = @_;
my $proto = "httptls";
- my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
+ my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP;
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $idnum = 1;
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($httptlspid <= 0 || !pidexists($httptlspid)) {
# it is NOT alive
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
$httptlspid = $pid2 = 0;
logmsg "RUN: failed to start the $srvrname server\n";
return (4, 0, 0);
}
- my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
+ my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP;
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1;
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($ftppid <= 0 || !pidexists($ftppid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0);
}
my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$port) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
#
sub runsecureserver {
my ($verb, $ipv6, $certfile, $proto, $clearport) = @_;
- my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
+ my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP;
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $idnum = 1;
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($tftppid <= 0 || !pidexists($tftppid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$port) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($dnspid <= 0 || !pidexists($dnspid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$port) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($rtsppid <= 0 || !pidexists($rtsppid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$port) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
# zero pid2 above.
if($sshpid <= 0 || !pidexists($sshpid)) {
# it is NOT alive
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
$sshpid = $pid2 = 0;
logmsg "RUN: failed to start the $srvrname server on $port\n";
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($sockspid <= 0 || !pidexists($sockspid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0);
}
my $mqttport = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$mqttport) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($sockspid <= 0 || !pidexists($sockspid)) {
# it is NOT alive
logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
$port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC);
if(!$port) {
logmsg "RUN: timeout for $srvrname to produce port file $portfile\n";
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
return (1, 0, 0, 0);
}
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($dictpid <= 0 || !pidexists($dictpid)) {
# it is NOT alive
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
$dictpid = $pid2 = 0;
logmsg "RUN: failed to start the $srvrname server\n";
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($smbpid <= 0 || !pidexists($smbpid)) {
# it is NOT alive
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
$smbpid = $pid2 = 0;
logmsg "RUN: failed to start the $srvrname server\n";
my $pid = processexists($pidfile);
if($pid > 0) {
- stopserver($server, "$pid");
+ stopserver($server, $pid);
}
unlink($pidfile) if(-f $pidfile);
if($ntelpid <= 0 || !pidexists($ntelpid)) {
# it is NOT alive
- stopserver($server, "$pid2");
+ stopserver($server, $pid2);
$doesntrun{$pidfile} = 1;
$ntelpid = $pid2 = 0;
logmsg "RUN: failed to start the $srvrname server\n";
#
sub responsive_mqtt_server {
my ($proto, $id, $verb, $ipv6) = @_;
- my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
+ my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP;
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1;
sub responsive_pingpong_server {
my ($proto, $id, $verb, $ipv6) = @_;
my $port;
- my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
+ my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP;
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1;
my $protoip = $proto . ($ipvnum == 6? '6': '');
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $proto = "httptls";
my $port = protoport($proto);
- my $ip = "$HOSTIP";
+ my $ip = $HOSTIP;
my $idnum = 1;
if($ipvnum == 6) {
$port = protoport("httptls6");
- $ip = "$HOST6IP";
+ $ip = $HOST6IP;
}
return &responsiveserver($proto, $ipvnum, $idnum, $ip, $port);
sub display_file {
my $filename = $_[0];
print "=== Start of file $filename\n";
- if(open(my $displayfh, "<", "$filename")) {
+ if(open(my $displayfh, "<", $filename)) {
while(my $line = <$displayfh>) {
- print "$line";
+ print $line;
}
close $displayfh;
}
sub display_file_top {
my $filename = $_[0];
print "=== Top of file $filename\n";
- if(open(my $displayfh, "<", "$filename")) {
+ if(open(my $displayfh, "<", $filename)) {
my $line = <$displayfh>;
- print "$line";
+ print $line;
close $displayfh;
}
print "=== End of file $filename\n";
#
if($sshdid =~ /OpenSSH-Windows/) {
# Fake pidfile for ssh server on Windows.
- if(open(my $out, ">", "$pidfile")) {
+ if(open(my $out, ">", $pidfile)) {
print $out $$ . "\n";
close($out);
}
sub scanheader {
my ($f)=@_;
- open my $h, "<", "$f";
+ open my $h, "<", $f;
while(<$h>) {
if(/^#define ((LIB|)CURL[A-Za-z0-9_]*)/) {
push @syms, $1;
sub checkmanpage {
my ($m) = @_;
- open(my $mh, "<", "$m");
+ open(my $mh, "<", $m);
my $line = 1;
while(<$mh>) {
# strip off formatting
}
$root = "$root/include/curl";
-opendir(D, "$root") || die "Cannot open directory $root: $!\n";
+opendir(D, $root) || die "Cannot open directory $root: $!\n";
my @dir = readdir(D);
closedir(D);
my $decl = $1;
$decl =~ s/\r$//;
$decl =~ /([a-z_]+)$/;
- push(@out, "$1");
+ push(@out, $1);
}
elsif(/^(^CURL_EXTERN .*)/) {
# handle two-line declarations
$decl =~ s/\r$//;
$first .= $decl;
$first =~ /([a-z_]+)$/;
- push(@out, "$1");
+ push(@out, $1);
}
$first = "";
}
sub scanmdpage {
my ($file, @words) = @_;
- open(my $mh, "<", "$file") ||
+ open(my $mh, "<", $file) ||
die "could not open $file";
my @m;
while(<$mh>) {
my $r;
# check for define aliases
-open($r, "<", "$curlh") ||
+open($r, "<", $curlh) ||
die "no curl.h";
while(<$r>) {
if(/^\#define (CURL(OPT|INFO|MOPT)_\w+) (.*)/) {
my @curlopt;
my @curlinfo;
my @curlmopt;
-open($r, "<", "$syms") ||
+open($r, "<", $syms) ||
die "no input file";
while(<$r>) {
chomp;
sub file {
my ($f) = @_;
- open(my $fh, "<", "$f") ||
+ open(my $fh, "<", $f) ||
die "test1140.pl could not open $f";
my $line = 1;
while(<$fh>) {
CURLOPT_RANDOM_FILE => 1,
);
sub allsymbols {
- open(my $f, "<", "$symbolsinversions") ||
+ open(my $f, "<", $symbolsinversions) ||
die "$symbolsinversions: $|";
while(<$f>) {
if($_ =~ /^([^ ]*) +(.*)/) {
my @separators;
my @sepline;
- open(my $m, "<", "$file") ||
+ open(my $m, "<", $file) ||
die "test1173.pl could not open $file";
if($file =~ /[\/\\](CURL|curl_)([^\/\\]*).3/) {
# This is a man page for libcurl. It requires an example unless it is
my %sourcename;
my $error=0;
-open(my $m, "<", "$manpage");
+open(my $m, "<", $manpage);
while(<$m>) {
if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) {
$manversion{$1}++;
}
close($m);
-open(my $h, "<", "$header");
+open(my $h, "<", $header);
while(<$h>) {
if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {
$headerversion{$1}++;
}
close($h);
-open(my $s, "<", "$source");
+open(my $s, "<", $source);
while(<$s>) {
if($_ =~ /FEATURE\("([^"]*)"/) {
$sourcename{$1}++;
my $incomment = 0;
my $inenum = 0;
- open(my $h, "<", "$f");
+ open(my $h, "<", $f);
while(<$h>) {
s/^\s*(.*?)\s*$/$1/; # Trim.
# Remove multi-line comment trail.
my $opt = "";
my $line = "";
- open(my $m, "<", "$f");
+ open(my $m, "<", $f);
while(<$m>) {
if($_ =~ /^\./) {
# roff directive found: end current option paragraph.
my ($path, $sym, $table)=@_;
my $version = "X";
- if(open(my $fh, "<", "$path")) {
+ if(open(my $fh, "<", $path)) {
my $section = "";
my $line = "";
if($f !~ /\.md\z/) {
return;
}
- open(my $fh, "<", "$f");
+ open(my $fh, "<", $f);
my $l;
my $prevl = '';
my $ignore = 0;
sub checkmanpage {
my ($m) = @_;
- open(my $mh, "<", "$m");
+ open(my $mh, "<", $m);
my $line = 1;
my $title;
my $addedin;
my $incomment = 0;
my @stringopts;
- open(my $h, "<", "$f");
+ open(my $h, "<", $f);
while(<$h>) {
s/^\s*(.*?)\s*$/$1/; # Trim.
# Remove multi-line comment trail.
my $inarmor = 0;
my @stringopts;
- open(my $h, "<", "$f");
+ open(my $h, "<", $f);
while(<$h>) {
if($_ =~ /(BEGIN|END) TRANSLATABLE STRING OPTIONS/) {
$inarmor = $1 eq "BEGIN";
sub mentions {
my ($f) = @_;
my @options;
- open(my $fh, "<", "$f");
+ open(my $fh, "<", $f);
while(<$fh>) {
chomp;
if(/(.*) +([0-9.]+)/) {
sub mydie($){
my $text=$_[0];
- logit "$text";
+ logit $text;
chdir $pwd; # cd back to the original root dir
if($pwd && $build) {
if(-r $buildlog) {
# we have a build log output file left, remove it
logit "removing the $buildlogname file";
- unlink "$buildlog";
+ unlink $buildlog;
}
logit "ENDING HERE"; # last line logged!
exit 1;
my $triplet;
my $configfile = "$pwd/$build/lib/curl_config.h";
- if(-f $configfile && -s $configfile && open(my $libconfigh, "<", "$configfile")) {
+ if(-f $configfile && -s $configfile && open(my $libconfigh, "<", $configfile)) {
while(<$libconfigh>) {
if($_ =~ /^\#define\s+CURL_OS\s+"*([^"][^"]*)"*\s*/) {
$triplet = $1;
$infixed=4;
$fixed=4;
}
-elsif(open(my $f, "<", "$setupfile")) {
+elsif(open(my $f, "<", $setupfile)) {
while(<$f>) {
if(/(\w+)=(.*)/) {
eval "\$$1=$2;";
if($fixed < 4) {
$fixed=4;
- open(my $f, ">", "$setupfile") or die;
+ open(my $f, ">", $setupfile) or die;
print $f "name='$name'\n";
print $f "email='$email'\n";
print $f "desc='$desc'\n";
}
# make the path absolute so we can use it everywhere
-$CURLDIR = File::Spec->rel2abs("$CURLDIR");
+$CURLDIR = File::Spec->rel2abs($CURLDIR);
$build="build-$$";
$buildlogname="buildlog-$$";
logit " $_";
}
- chdir "$CURLDIR";
+ chdir $CURLDIR;
}
if($nobuildconf) {
# generate the build files
logit "invoke autoreconf";
open(my $f, "-|", "autoreconf -fi 2>&1") or die;
- open(my $log, ">", "$buildlog") or die;
+ open(my $log, ">", $buildlog) or die;
while(<$f>) {
my $ll = $_;
print $ll;
open($f, "-|", "$make -f Makefile.$targetos 2>&1") or die;
}
else {
- logit "$make";
+ logit $make;
open($f, "-|", "$make 2>&1") or die;
}
while(<$f>) {
}
my $mkcmd = "$make -i" . ($targetos && !$configurebuild ? " $targetos" : "");
-logit "$mkcmd";
+logit $mkcmd;
open($f, "-|", "$mkcmd 2>&1") or die;
while(<$f>) {
s/$pwd//g;
chdir "$pwd/$build/docs/examples";
logit_spaced "build examples";
open($f, "-|", "$make -i 2>&1") or die;
- open(my $log, ">", "$buildlog") or die;
+ open(my $log, ">", $buildlog) or die;
while(<$f>) {
s/$pwd//g;
print;
}
logit "$make -k ${o}test-full";
open($f, "-|", "$make -k ${o}test-full 2>&1") or die;
- open(my $log, ">", "$buildlog") or die;
+ open(my $log, ">", $buildlog) or die;
while(<$f>) {
s/$pwd//g;
print;
chdir "$pwd/$build/docs/examples";
logit_spaced "build examples";
open($f, "-|", "$make -i 2>&1") or die;
- open(my $log, ">", "$buildlog") or die;
+ open(my $log, ">", $buildlog) or die;
while(<$f>) {
s/$pwd//g;
print;
chdir "$pwd/$build/tests";
logit_spaced "build test harness";
open(my $f, "-|", "$make -i 2>&1") or die;
- open(my $log, ">", "$buildlog") or die;
+ open(my $log, ">", $buildlog) or die;
while(<$f>) {
s/$pwd//g;
print;
sub valgrindparse {
my ($file) = @_;
my @o;
- open(my $val, "<", "$file") ||
+ open(my $val, "<", $file) ||
return;
@o = <$val>;
close($val);