]> arthur.barton.de Git - bup.git/blobdiff - t/compare-trees
do_bloom(): remove unused "count" variable
[bup.git] / t / compare-trees
index 80b056a1cdc8b73009c9cff434867bd4a99056ae..3f99b3c4c69a6ab63f6314daecc7415b9d4840ba 100755 (executable)
@@ -3,9 +3,6 @@
 # Test that src and dest trees are as identical as bup is capable of
 # making them.  For now, use rsync -niaHAX ...
 
-set -e
-set -o pipefail
-
 usage() {
 cat <<EOF
 Usage: compare-trees [-h] [-c] [-x] SOURCE DEST
@@ -31,7 +28,7 @@ do
     esac
 done
 
-shift $(($OPTIND - 1))
+shift $(($OPTIND - 1)) || exit $?
 
 if ! test $# -eq 2
 then
@@ -42,27 +39,36 @@ fi
 src="$1"
 dest="$2"
 
-tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)"
-trap "rm -rf '${tmpfile}'" EXIT
+tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)" || exit $?
+trap "rm -rf '$tmpfile'" EXIT || exit $?
 
 rsync_opts="-niaH$verify_content --delete"
 
-if rsync --version | grep -q xattrs; then
-    if [[ $(uname) =~ CYGWIN ]]; then
-        # bup doesn't support ACLs on Cygwin yet.
-        rsync_opts="$rsync_opts -X"
-    else
-        rsync_opts="$rsync_opts -AX"
-    fi
+rsync_version=$(rsync --version)
+if [[ ! "$rsync_version" =~ "ACLs" ]] || [[ "$rsync_version" =~ "no ACLs" ]]; then
+    echo "Not comparing ACLs (not supported by available rsync)" 1>&2
+else
+    case $OSTYPE in
+        cygwin|darwin|netbsd)
+            echo "Not comparing ACLs (not yet supported on $OSTYPE)" 1>&2
+            ;;
+        *)
+            rsync_opts="$rsync_opts -A"
+            ;;
+    esac
+fi
+
+if [[ ! "$rsync_version" =~ "xattrs" ]] || [[ "$rsync_version" =~ "no xattrs" ]]; then
+    echo "Not comparing xattrs (not supported by available rsync)" 1>&2
 else
-    echo "Not comparing xattrs/acls (unsupported by available rsync)." 1>&2
+    rsync_opts="$rsync_opts -X"
 fi
 
-rsync $rsync_opts "$src" "$dest" > "${tmpfile}"
+rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $?
 
-if test $(wc -l < "${tmpfile}") != 0; then
+if test $(wc -l < "$tmpfile") != 0; then
     echo "Differences between $src and $dest"
-    cat "${tmpfile}"
+    cat "$tmpfile"
     exit 1
 fi