[PATCH 4/5] test-wrap-argv: print diff instead of the incorrectly wrapped file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit c9c03ea stopped creating an intermediate file during syntax-check
to save on execution time. It also switched to outputting the whole
incorrectly wrapped file instead of a diff needed to fix it.

Feed the newly wrapped file to diff via a pipe.

Note that fixing it by running test-wrap-argv.pl --in-place or
the unit test with VIR_TEST_REGENERATE_OUTPUT is easier.
---
 tests/test-wrap-argv.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/test-wrap-argv.pl b/tests/test-wrap-argv.pl
index b053f28..6adaef9 100755
--- a/tests/test-wrap-argv.pl
+++ b/tests/test-wrap-argv.pl
@@ -89,7 +89,10 @@ sub rewrap {
         my $nl = join('', @lines);
         my $ol = join('', @orig_lines);
         unless ($nl eq $ol) {
-            print STDERR $ol;
+            open DIFF, "| diff -u $file -" or die "cannot run diff: $!";
+            print DIFF $nl;
+            close DIFF;
+
             print STDERR "Incorrect line wrapping in $file\n";
             print STDERR "Use test-wrap-argv.pl to wrap test data files\n";
             return -1;
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]