]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test-wrap-argv: print diff instead of the incorrectly wrapped file
authorJán Tomko <jtomko@redhat.com>
Mon, 11 Jul 2016 14:15:02 +0000 (16:15 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 12 Jul 2016 10:15:50 +0000 (12:15 +0200)
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

index b053f28bf2d30534b6c9c380dc56a886d1cb2a08..6adaef9016cbff70646fbcbf3f46116b4d276a48 100755 (executable)
@@ -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;