mirror of
https://github.com/curl/curl.git
synced 2025-09-16 00:52:42 +03:00
runtests: stop copying a few arrays where not needed
Unlike some other languages that just copy a pointer, perl copies the entire array contents which takes time for a large array. Ref: #10818
This commit is contained in:
parent
d428f00db0
commit
1dc3088de3
|
@ -4554,22 +4554,20 @@ sub singletest {
|
||||||
# Verify the sent request
|
# Verify the sent request
|
||||||
my @out = loadarray($SERVERIN);
|
my @out = loadarray($SERVERIN);
|
||||||
|
|
||||||
my @protstrip=@protocol;
|
|
||||||
|
|
||||||
# check if there's any attributes on the verify/protocol section
|
# check if there's any attributes on the verify/protocol section
|
||||||
my %hash = getpartattr("verify", "protocol");
|
my %hash = getpartattr("verify", "protocol");
|
||||||
|
|
||||||
if($hash{'nonewline'}) {
|
if($hash{'nonewline'}) {
|
||||||
# Yes, we must cut off the final newline from the final line
|
# Yes, we must cut off the final newline from the final line
|
||||||
# of the protocol data
|
# of the protocol data
|
||||||
chomp($protstrip[$#protstrip]);
|
chomp($protocol[$#protocol]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(@strip) {
|
for(@strip) {
|
||||||
# strip off all lines that match the patterns from both arrays
|
# strip off all lines that match the patterns from both arrays
|
||||||
chomp $_;
|
chomp $_;
|
||||||
@out = striparray( $_, \@out);
|
@out = striparray( $_, \@out);
|
||||||
@protstrip= striparray( $_, \@protstrip);
|
@protocol= striparray( $_, \@protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $strip;
|
my $strip;
|
||||||
|
@ -4582,17 +4580,17 @@ sub singletest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($hash{'crlf'}) {
|
if($hash{'crlf'}) {
|
||||||
map subNewlines(1, \$_), @protstrip;
|
map subNewlines(1, \$_), @protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!$out[0] || ($out[0] eq "")) && $protstrip[0]) {
|
if((!$out[0] || ($out[0] eq "")) && $protocol[0]) {
|
||||||
logmsg "\n $testnum: protocol FAILED!\n".
|
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 $SERVERIN.\n".
|
||||||
" Server glitch? Total curl failure? Returned: $cmdres\n";
|
" Server glitch? Total curl failure? Returned: $cmdres\n";
|
||||||
return $errorreturncode;
|
return $errorreturncode;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = compare($testnum, $testname, "protocol", \@out, \@protstrip);
|
$res = compare($testnum, $testname, "protocol", \@out, \@protocol);
|
||||||
if($res) {
|
if($res) {
|
||||||
return $errorreturncode;
|
return $errorreturncode;
|
||||||
}
|
}
|
||||||
|
@ -4642,23 +4640,21 @@ sub singletest {
|
||||||
my @proxyprot = getpart("verify", "proxy");
|
my @proxyprot = getpart("verify", "proxy");
|
||||||
if(@proxyprot) {
|
if(@proxyprot) {
|
||||||
# Verify the sent proxy request
|
# Verify the sent proxy request
|
||||||
my @out = loadarray($PROXYIN);
|
|
||||||
my @protstrip=@proxyprot;
|
|
||||||
|
|
||||||
# check if there's any attributes on the verify/protocol section
|
# check if there's any attributes on the verify/protocol section
|
||||||
my %hash = getpartattr("verify", "proxy");
|
my %hash = getpartattr("verify", "proxy");
|
||||||
|
|
||||||
if($hash{'nonewline'}) {
|
if($hash{'nonewline'}) {
|
||||||
# Yes, we must cut off the final newline from the final line
|
# Yes, we must cut off the final newline from the final line
|
||||||
# of the protocol data
|
# of the protocol data
|
||||||
chomp($protstrip[$#protstrip]);
|
chomp($proxyprot[$#proxyprot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my @out = loadarray($PROXYIN);
|
||||||
for(@strip) {
|
for(@strip) {
|
||||||
# strip off all lines that match the patterns from both arrays
|
# strip off all lines that match the patterns from both arrays
|
||||||
chomp $_;
|
chomp $_;
|
||||||
@out = striparray( $_, \@out);
|
@out = striparray( $_, \@out);
|
||||||
@protstrip= striparray( $_, \@protstrip);
|
@proxyprot= striparray( $_, \@proxyprot);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $strip;
|
my $strip;
|
||||||
|
@ -4671,10 +4667,10 @@ sub singletest {
|
||||||
|
|
||||||
if($hash{'crlf'} ||
|
if($hash{'crlf'} ||
|
||||||
($has_hyper && ($keywords{"HTTP"} || $keywords{"HTTPS"}))) {
|
($has_hyper && ($keywords{"HTTP"} || $keywords{"HTTPS"}))) {
|
||||||
map subNewlines(0, \$_), @protstrip;
|
map subNewlines(0, \$_), @proxyprot;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = compare($testnum, $testname, "proxy", \@out, \@protstrip);
|
$res = compare($testnum, $testname, "proxy", \@out, \@proxyprot);
|
||||||
if($res) {
|
if($res) {
|
||||||
return $errorreturncode;
|
return $errorreturncode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user