tidy-up: whitespace (more in Perl)

Follow-up to 8eab2b7086 #17896
Cherry-picked from #17877
Closes #17901
This commit is contained in:
Viktor Szakats 2025-07-11 16:04:24 +02:00
parent 8eab2b7086
commit ddcfd2d511
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
43 changed files with 84 additions and 98 deletions

View file

@ -65,7 +65,7 @@ sub appveyor_create_test_result {
}
' \\
'$appveyor_baseurl/api/tests'`;
print "AppVeyor API result: $appveyor_result\n" if ($appveyor_result);
print "AppVeyor API result: $appveyor_result\n" if($appveyor_result);
$APPVEYOR_TEST_NAMES{$testnum}=$testname;
}
@ -111,7 +111,7 @@ sub appveyor_update_test_result {
}
' \\
'$appveyor_baseurl/api/tests'`;
print "AppVeyor API result: $appveyor_result\n" if ($appveyor_result);
print "AppVeyor API result: $appveyor_result\n" if($appveyor_result);
if($appveyor_category eq 'Error') {
$appveyor_result=`$curl --silent --noproxy '*' \\
--header 'Content-Type: application/json' \\
@ -123,7 +123,7 @@ sub appveyor_update_test_result {
}
' \\
'$appveyor_baseurl/api/build/messages'`;
print "AppVeyor API result: $appveyor_result\n" if ($appveyor_result);
print "AppVeyor API result: $appveyor_result\n" if($appveyor_result);
}
}

View file

@ -62,7 +62,7 @@ HTTP follow redirect from IPv4 to IPv6 with scope
http://%HOSTIP:%HTTPPORT/we/are/all/twits/%TESTNUMBER -L
</command>
<precheck>
%PERL -e "print 'Test is not supported on the Windows kernel' if ($^O eq 'MSWin32' || $^O eq 'msys' || $^O eq 'cygwin');"
%PERL -e "print 'Test is not supported on the Windows kernel' if($^O eq 'MSWin32' || $^O eq 'msys' || $^O eq 'cygwin');"
</precheck>
</client>

View file

@ -35,7 +35,7 @@ HTTP GET with localhost --interface
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -4 --interface 127.0.0.1
</command>
<precheck>
%PERL -e "print 'Test requires default test client host address' if ( '%CLIENTIP' ne '127.0.0.1' );"
%PERL -e "print 'Test requires default test client host address' if('%CLIENTIP' ne '127.0.0.1');"
</precheck>
</client>

View file

@ -39,7 +39,7 @@ HTTP-IPv6 GET with ip6-localhost --interface
-g "http://%HOST6IP:%HTTP6PORT/%TESTNUMBER" --interface ip6-localhost
</command>
<precheck>
%PERL -e "if ('%CLIENT6IP' ne '[::1]') {print 'Test requires default test client host address';} else {exec '%RESOLVE --ipv6 ip6-localhost'; print 'Cannot run precheck resolve';}"
%PERL -e "if('%CLIENT6IP' ne '[::1]') {print 'Test requires default test client host address';} else {exec '%RESOLVE --ipv6 ip6-localhost'; print 'Cannot run precheck resolve';}"
</precheck>
</client>

View file

@ -89,7 +89,7 @@ Accept: */*
* Connection #3 to host server4.example.com left intact
</file>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /Closing connection/))
</stripfile>
</verify>
</testcase>

View file

@ -89,7 +89,7 @@ Accept: */*
* Connection #3 to host server4.example.com left intact
</file>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /Closing connection/))
</stripfile>
</verify>
</testcase>

View file

@ -74,7 +74,7 @@ Accept: */*
^Host:.*
</strip>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /Closing connection/))
</stripfile>
</verify>
</testcase>

View file

@ -62,7 +62,7 @@ Accept: */*
== Info: Connection #1 to host %HOSTIP left intact
</file>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /(closing|shutting down) connection #\d+/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /(closing|shutting down) connection #\d+/))
</stripfile>
</verify>
</testcase>

View file

@ -27,7 +27,7 @@ file:// with Unix path resolution behavior for the case of extra slashes
file:////%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt
</command>
<precheck>
%PERL -e "print 'Test requires a Unix system' if ( $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'dos' || $^O eq 'msys');"
%PERL -e "print 'Test requires a Unix system' if($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'dos' || $^O eq 'msys');"
</precheck>
<file name="%LOGDIR/test%TESTNUMBER.txt">
foo

View file

@ -102,7 +102,7 @@ Via: 2 nghttpx
* Connection #0 to host localhost left intact
</file>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /Closing connection/))
</stripfile>
</verify>
</testcase>

View file

@ -102,7 +102,7 @@ Via: 2 nghttpx
* Connection #0 to host localhost left intact
</file>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /Closing connection/))
</stripfile>
</verify>
</testcase>

View file

@ -97,7 +97,7 @@ Via: 3 nghttpx
== Info: Connection #0 to host localhost left intact
</file>
<stripfile>
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/))
$_ = '' if(($_ !~ /left intact/) && ($_ !~ /Closing connection/))
</stripfile>
</verify>
</testcase>

View file

@ -79,7 +79,7 @@ Set-Cookie: cookie31=%hex[%7f-junk]hex%
</file>
<precheck>
%PERL -e 'if ("%HOSTIP" !~ /\.0\.0\.1$/) {print "Test only works for HOSTIPs ending with .0.0.1"; exit(1)}'
%PERL -e 'if("%HOSTIP" !~ /\.0\.0\.1$/) {print "Test only works for HOSTIPs ending with .0.0.1"; exit(1)}'
</precheck>
<features>
cookies

View file

@ -38,7 +38,7 @@ MEM tool_cfgable.c
MEM tool_cfgable.c
</file>
<stripfile>
$_ = '' if ((($_ !~ /tool_paramhlp/) && ($_ !~ /tool_cfgable/)) || ($_ =~ /free\(\(nil\)\)/))
$_ = '' if((($_ !~ /tool_paramhlp/) && ($_ !~ /tool_cfgable/)) || ($_ =~ /free\(\(nil\)\)/))
s/:\d+.*//
s:^(MEM )(.*/)(.*):$1$3:
</stripfile>

View file

@ -35,7 +35,7 @@ my $what=$ARGV[2];
my $curl_protocols="";
open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
while(<CURL>) {
$curl_protocols = $_ if ( /$what:/i );
$curl_protocols = $_ if(/$what:/i);
}
close CURL;

View file

@ -36,8 +36,7 @@ sub errout {
exit 1;
}
if($ARGV[0] eq "prepare")
{
if($ARGV[0] eq "prepare") {
my $dirname = $ARGV[1];
mkdir $dirname || errout "$!";
chdir $dirname;
@ -71,8 +70,7 @@ if($ARGV[0] eq "prepare")
exit 0;
}
elsif($ARGV[0] eq "postprocess")
{
elsif($ARGV[0] eq "postprocess") {
my $dirname = $ARGV[1];
my $logfile = $ARGV[2];

View file

@ -121,7 +121,7 @@ sub sys_native_abs_path {
return File::Spec->rel2abs($path) if !os_is_win();
# Do not process empty path.
return $path if ($path eq '');
return $path if($path eq '');
my $res;
if($^O eq 'msys' || $^O eq 'cygwin') {

View file

@ -305,7 +305,7 @@ delete $ENV{'CURL_CA_BUNDLE'} if($ENV{'CURL_CA_BUNDLE'});
# set by the caller
if(open(my $fd, "<", "config")) {
while(my $line = <$fd>) {
next if ($line =~ /^#/);
next if($line =~ /^#/);
chomp $line;
my ($name, $val) = split(/\s*:\s*/, $line, 2);
$ENV{$name} = $val if(!$ENV{$name});
@ -941,7 +941,7 @@ sub timestampskippedevents {
sub citest_starttestrun {
if(azure_check_environment()) {
$AZURE_RUN_ID = azure_create_test_run($ACURL);
logmsg "Azure Run ID: $AZURE_RUN_ID\n" if ($verbose);
logmsg "Azure Run ID: $AZURE_RUN_ID\n" if($verbose);
}
# Appveyor doesn't require anything here
}
@ -2294,7 +2294,7 @@ while(@ARGV) {
my $exclude_file = $ARGV[0];
open(my $fd, "<", $exclude_file) or die "Couldn't open '$exclude_file': $!";
while(my $line = <$fd>) {
next if ($line =~ /^#/);
next if($line =~ /^#/);
chomp $line;
my ($type, $patterns, $skip_reason) = split(/\s*:\s*/, $line, 3);
@ -2697,7 +2697,7 @@ sub disabledtests {
# fail hard to make user notice
exit 1;
}
logmsg "DISABLED: test $n\n" if ($verbose);
logmsg "DISABLED: test $n\n" if($verbose);
}
else {
print STDERR "$file: rubbish content: $t\n";

View file

@ -166,7 +166,7 @@ sub checkcmd {
"/sbin", "/usr/bin", "/usr/local/bin", @extrapaths);
}
for(@paths) {
if( -x "$_/$cmd" . exe_ext('SYS') && ! -d "$_/$cmd" . exe_ext('SYS')) {
if(-x "$_/$cmd" . exe_ext('SYS') && ! -d "$_/$cmd" . exe_ext('SYS')) {
# executable bit but not a directory!
return "$_/$cmd";
}
@ -345,7 +345,7 @@ sub serverfortest {
sub startnew {
my ($cmd, $pidfile, $timeout, $fakepidfile)=@_;
logmsg "startnew: $cmd\n" if ($verbose);
logmsg "startnew: $cmd\n" if($verbose);
my $child = fork();
@ -504,7 +504,7 @@ sub stopserver {
foreach my $lockfile (@lockfiles) {
if(-f $lockfile) {
unlink($lockfile);
logmsg "RUN: kill $server, cleaned up $lockfile\n" if ($verbose);
logmsg "RUN: kill $server, cleaned up $lockfile\n" if($verbose);
}
}
}
@ -3029,7 +3029,7 @@ sub startservers {
}
}
elsif($what eq "none") {
logmsg "* starts no server\n" if ($verbose);
logmsg "* starts no server\n" if($verbose);
}
else {
warn "we don't support a server for $what";

View file

@ -67,8 +67,8 @@ my %rem;
sub scanenum {
my ($file) = @_;
open my $h_in, "-|", "$Cpreprocessor $i$file" || die "Cannot preprocess $file";
while( <$h_in> ) {
if( /enum\s+(\S+\s+)?{/ .. /}/ ) {
while(<$h_in>) {
if(/enum\s+(\S+\s+)?{/ .. /}/) {
s/^\s+//;
next unless /^CURL/;
chomp;

View file

@ -22,8 +22,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
#
#
use strict;
use warnings;

View file

@ -202,7 +202,7 @@ while(<$r>) {
$list=1;
}
elsif($list) {
if( /^ \{(\"[^,]*\").*\'(.)\',/) {
if(/^ \{(\"[^,]*\").*\'(.)\',/) {
my ($l, $s)=($1, $2);
my $sh;
my $lo;

View file

@ -22,7 +22,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
#
use strict;
use warnings;

View file

@ -76,7 +76,7 @@ sub scanenums {
die "Cannot preprocess $file";
while(<H_IN>) {
my ($line, $linenum) = ($_, $.);
if( /^#(line|) (\d+) \"(.*)\"/) {
if(/^#(line|) (\d+) \"(.*)\"/) {
# if the included file isn't in our incdir, then we skip this section
# until next #line
#
@ -94,7 +94,7 @@ sub scanenums {
if(/^#/) {
next;
}
if( /enum\s+(\S+\s+)?{/ .. /}/ ) {
if(/enum\s+(\S+\s+)?{/ .. /}/) {
s/^\s+//;
chomp;
s/[,\s].*//;

View file

@ -107,7 +107,7 @@ sub checkref {
return;
}
foreach my $d (keys %docsdirs) {
if( -f "$d/$f.$sec") {
if(-f "$d/$f.$sec") {
$present = 1;
$ref{"$f.$sec"}=1;
last;

View file

@ -22,8 +22,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
#
#
use strict;
use warnings;

View file

@ -22,8 +22,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
#
#
use strict;
use warnings;

View file

@ -127,14 +127,12 @@ close $s;
my $ignored=0;
for my $e (sort @syms) {
if( $manpage{$e} ) {
if( $manpage{$e} ne $symadded{$e} ) {
if($manpage{$e}) {
if($manpage{$e} ne $symadded{$e}) {
printf "%s.md says version %s, but SIV says %s\n",
$e, $manpage{$e}, $symadded{$e};
$error++;
}
}
}
print "OK\n" if(!$error);

View file

@ -22,8 +22,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
#
#
use strict;
use warnings;

View file

@ -23,7 +23,6 @@
#
###########################################################################
#
#
# - Get all options mentioned in the $cmddir.
# - Make sure they're all mentioned in the $opts document
# - Make sure that the version in $opts matches the version in the file in

View file

@ -177,8 +177,8 @@ if(($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') &&
$confheader = 'config-win32.h';
}
$ENV{LC_ALL}="C" if (($ENV{LC_ALL}) && ($ENV{LC_ALL} !~ /^C$/));
$ENV{LC_CTYPE}="C" if (($ENV{LC_CTYPE}) && ($ENV{LC_CTYPE} !~ /^C$/));
$ENV{LC_ALL}="C" if(($ENV{LC_ALL}) && ($ENV{LC_ALL} !~ /^C$/));
$ENV{LC_CTYPE}="C" if(($ENV{LC_CTYPE}) && ($ENV{LC_CTYPE} !~ /^C$/));
$ENV{LANG}="C";
sub rmtree($) {
@ -371,11 +371,11 @@ if(-d $CURLDIR) {
# time we run this test
unlink "$CURLDIR/src/tool_hugehelp.c";
# find out if curl source dir has an in-tree c-ares repo
$have_embedded_ares = 1 if (-f "$CURLDIR/ares/GIT-INFO");
$have_embedded_ares = 1 if(-f "$CURLDIR/ares/GIT-INFO");
} elsif(!$git && -f "$CURLDIR/tests/testcurl.pl") {
logit "$CURLDIR is verified to be a fine daily source dir";
# find out if curl source dir has an in-tree c-ares extracted tarball
$have_embedded_ares = 1 if (-f "$CURLDIR/ares/ares_build.h");
$have_embedded_ares = 1 if(-f "$CURLDIR/ares/ares_build.h");
} else {
mydie "$CURLDIR is not a daily source dir or checked out from git!"
}
@ -419,10 +419,10 @@ if($git) {
logit "run git pull in curl";
system("git pull 2>&1");
$gitstat += $?;
logit "failed to update from curl git ($?), continue anyway" if ($?);
logit "failed to update from curl git ($?), continue anyway" if($?);
# Set timestamp to the UTC the git update took place.
$timestamp = scalar(gmtime)." UTC" if (!$gitstat);
$timestamp = scalar(gmtime)." UTC" if(!$gitstat);
}
# get the last 5 commits for show (even if no pull was made)
@ -442,10 +442,10 @@ if($git) {
logit "run git pull in ares";
system("git pull 2>&1");
$gitstat += $?;
logit "failed to update from ares git ($?), continue anyway" if ($?);
logit "failed to update from ares git ($?), continue anyway" if($?);
# Set timestamp to the UTC the git update took place.
$timestamp = scalar(gmtime)." UTC" if (!$gitstat);
$timestamp = scalar(gmtime)." UTC" if(!$gitstat);
}
# get the last 5 commits for show (even if no pull was made)
@ -535,7 +535,7 @@ sub findinpath {
my @pa = split($s, $p);
for $c (@_) {
for $e (@pa) {
if( -x "$e/$c$x") {
if(-x "$e/$c$x") {
return $c;
}
}
@ -547,7 +547,7 @@ if(!$make) {
mydie "Couldn't find make in the PATH";
}
# force to 'nmake' for VC builds
$make = "nmake" if ($targetos =~ /vc/);
$make = "nmake" if($targetos =~ /vc/);
logit "going with $make as make";
# change to build dir
@ -683,7 +683,7 @@ if(!$crosscompile || (($extvercmd ne '') && (-x $extvercmd))) {
open($f, "<", $cmd);
while(<$f>) {
# strip CR from output on non-Windows platforms (WINE on Linux)
s/\r// if ($^O ne 'MSWin32');
s/\r// if($^O ne 'MSWin32');
print;
}
close($f);