diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2023-04-21 11:10:22 -0700 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2023-04-22 13:07:35 -0700 |
commit | a8706fd8d040b554dfa6bd4af2481d40150ed327 (patch) | |
tree | 9ee4ef3d10db9ddca1f954e009317da23a02170d | |
parent | 20fa5b74a5349045272d6e7f7af53bee65f17fa2 (diff) | |
download | curl-a8706fd8d040b554dfa6bd4af2481d40150ed327.tar.gz |
runtests: move showdiff into runtests.pl
It's not used anywhere else.
-rw-r--r-- | tests/getpart.pm | 50 | ||||
-rwxr-xr-x | tests/runtests.pl | 41 |
2 files changed, 46 insertions, 45 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm index 043261bc2..ed60feca5 100644 --- a/tests/getpart.pm +++ b/tests/getpart.pm @@ -31,16 +31,15 @@ BEGIN { use base qw(Exporter); our @EXPORT = qw( - getpartattr + compareparts + fulltest getpart - partexists + getpartattr + loadarray loadtest - fulltest + partexists striparray - compareparts writearray - loadarray - showdiff ); } @@ -356,44 +355,5 @@ sub loadarray { return @array; } -# Given two array references, this function will store them in two temporary -# files, run 'diff' on them, store the result and return the diff output! - -sub showdiff { - my ($logdir, $firstref, $secondref)=@_; - - my $file1="$logdir/check-generated"; - my $file2="$logdir/check-expected"; - - open(my $temp, ">", "$file1") || die "Failure writing diff file"; - for(@$firstref) { - my $l = $_; - $l =~ s/\r/[CR]/g; - $l =~ s/\n/[LF]/g; - $l =~ s/([^\x20-\x7f])/sprintf "%%%02x", ord $1/eg; - print $temp $l; - print $temp "\n"; - } - close($temp) || die "Failure writing diff file"; - - open($temp, ">", "$file2") || die "Failure writing diff file"; - for(@$secondref) { - my $l = $_; - $l =~ s/\r/[CR]/g; - $l =~ s/\n/[LF]/g; - $l =~ s/([^\x20-\x7f])/sprintf "%%%02x", ord $1/eg; - print $temp $l; - print $temp "\n"; - } - close($temp) || die "Failure writing diff file"; - my @out = `diff -u $file2 $file1 2>/dev/null`; - - if(!$out[0]) { - @out = `diff -c $file2 $file1 2>/dev/null`; - } - - return @out; -} - 1; diff --git a/tests/runtests.pl b/tests/runtests.pl index ca68c00f3..0b29a4653 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -297,6 +297,47 @@ sub cleardir { return $done; } + +####################################################################### +# Given two array references, this function will store them in two temporary +# files, run 'diff' on them, store the result and return the diff output! +sub showdiff { + my ($logdir, $firstref, $secondref)=@_; + + my $file1="$logdir/check-generated"; + my $file2="$logdir/check-expected"; + + open(my $temp, ">", "$file1") || die "Failure writing diff file"; + for(@$firstref) { + my $l = $_; + $l =~ s/\r/[CR]/g; + $l =~ s/\n/[LF]/g; + $l =~ s/([^\x20-\x7f])/sprintf "%%%02x", ord $1/eg; + print $temp $l; + print $temp "\n"; + } + close($temp) || die "Failure writing diff file"; + + open($temp, ">", "$file2") || die "Failure writing diff file"; + for(@$secondref) { + my $l = $_; + $l =~ s/\r/[CR]/g; + $l =~ s/\n/[LF]/g; + $l =~ s/([^\x20-\x7f])/sprintf "%%%02x", ord $1/eg; + print $temp $l; + print $temp "\n"; + } + close($temp) || die "Failure writing diff file"; + my @out = `diff -u $file2 $file1 2>/dev/null`; + + if(!$out[0]) { + @out = `diff -c $file2 $file1 2>/dev/null`; + } + + return @out; +} + + ####################################################################### # compare test results with the expected output, we might filter off # some pattern that is allowed to differ, output test results |