]> arthur.barton.de Git - bup.git/commitdiff
compare-trees: redirect incidental info to stderr
authorRob Browning <rlb@defaultvalue.org>
Mon, 9 Mar 2015 01:49:49 +0000 (20:49 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 9 Mar 2015 01:49:49 +0000 (20:49 -0500)
Leave stdout for the rsync --itemize-changes output, so we can use it in
tests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/compare-trees
t/test-meta.sh

index 3f99b3c4c69a6ab63f6314daecc7415b9d4840ba..41fb7ac7976e735609c134bc55af6b65f0bac013 100755 (executable)
@@ -67,7 +67,7 @@ fi
 rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $?
 
 if test $(wc -l < "$tmpfile") != 0; then
-    echo "Differences between $src and $dest"
+    echo "Differences between $src and $dest" 1>&2
     cat "$tmpfile"
     exit 1
 fi
index c7d1fb86cb2f63d81647e200b7d2ccaab6e203b1..573ad8c4083ea1a1fcee4668e2803ead9346868d 100755 (executable)
@@ -170,8 +170,14 @@ WVSTART 'metadata save/restore (general)'
     WVPASS touch -t 201211111111 src-restore # Make sure the top won't match.
     # Check that the only difference is the top dir.
     WVFAIL $TOP/t/compare-trees -c src/lib/ src-restore/ > tmp-compare-trees
-    WVPASSEQ $(cat tmp-compare-trees | wc -l) 2
-    WVPASS tail -n +2 tmp-compare-trees | WVPASS grep -qE '^\.d[^ ]+ \./$'
+    WVPASSEQ $(cat tmp-compare-trees | wc -l) 1
+    # Note: OS X rsync itemize output is currently only 9 chars, not 11.
+    expected_diff_rx='^\.d\.\.t.\.\.\.\.?\.? \./$'
+    if ! grep -qE "$expected_diff_rx" tmp-compare-trees; then
+        echo -n 'tmp-compare-trees: ' 1>&2
+        cat tmp-compare-trees 1>&2
+    fi
+    WVPASS grep -qE "$expected_diff_rx" tmp-compare-trees
     WVPASS rm -r "$tmpdir"
 ) || exit $?