mirror of https://github.com/moparisthebest/curl
Fixed the array comparison function even more, made the temporary files used
for diff output get created in the log/ dir and no longer deletes them since they help in understanding the problem, fixing the test case and fixing curl problems.
This commit is contained in:
parent
c28e15c682
commit
4781ff88fd
|
@ -154,22 +154,8 @@ sub striparray {
|
||||||
sub compareparts {
|
sub compareparts {
|
||||||
my ($firstref, $secondref)=@_;
|
my ($firstref, $secondref)=@_;
|
||||||
|
|
||||||
my $sizefirst=scalar(@$firstref);
|
my $first = join("", @$firstref);
|
||||||
my $sizesecond=scalar(@$secondref);
|
my $second = join("", @$secondref);
|
||||||
|
|
||||||
my $first;
|
|
||||||
my $second;
|
|
||||||
|
|
||||||
for(1 .. $sizefirst) {
|
|
||||||
my $index = $_ - 1;
|
|
||||||
if($firstref->[$index] ne $secondref->[$index]) {
|
|
||||||
(my $aa = $firstref->[$index]) =~ s/\r+\n$/\n/;
|
|
||||||
(my $bb = $secondref->[$index]) =~ s/\r+\n$/\n/;
|
|
||||||
|
|
||||||
$first .= $firstref->[$index];
|
|
||||||
$second .= $secondref->[$index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# we cannot compare arrays index per index since with the base64 chunks,
|
# we cannot compare arrays index per index since with the base64 chunks,
|
||||||
# they may not be "evenly" distributed
|
# they may not be "evenly" distributed
|
||||||
|
@ -214,16 +200,14 @@ sub loadarray {
|
||||||
return @array;
|
return @array;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
# Given two array references, this function will store them in two temporary
|
||||||
# Given two array references, this function will store them in two
|
# files, run 'diff' on them, store the result and return the diff output!
|
||||||
# temporary files, run 'diff' on them, store the result, remove the
|
|
||||||
# temp files and return the diff output!
|
|
||||||
#
|
|
||||||
sub showdiff {
|
|
||||||
my ($firstref, $secondref)=@_;
|
|
||||||
|
|
||||||
my $file1=".generated";
|
sub showdiff {
|
||||||
my $file2=".expected";
|
my ($logdir, $firstref, $secondref)=@_;
|
||||||
|
|
||||||
|
my $file1="$logdir/check-generated";
|
||||||
|
my $file2="$logdir/check-expected";
|
||||||
|
|
||||||
open(TEMP, ">$file1");
|
open(TEMP, ">$file1");
|
||||||
for(@$firstref) {
|
for(@$firstref) {
|
||||||
|
@ -238,7 +222,6 @@ sub showdiff {
|
||||||
close(TEMP);
|
close(TEMP);
|
||||||
my @out = `diff -u $file2 $file1`;
|
my @out = `diff -u $file2 $file1`;
|
||||||
|
|
||||||
unlink $file1, $file2;
|
|
||||||
return @out;
|
return @out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -653,7 +653,7 @@ sub compare {
|
||||||
if($result) {
|
if($result) {
|
||||||
if(!$short) {
|
if(!$short) {
|
||||||
print "\n $subject FAILED:\n";
|
print "\n $subject FAILED:\n";
|
||||||
print showdiff($firstref, $secondref);
|
print showdiff($LOGDIR, $firstref, $secondref);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print "FAILED\n";
|
print "FAILED\n";
|
||||||
|
|
Loading…
Reference in New Issue