]> arthur.barton.de Git - bup.git/blobdiff - t/test-import-duplicity.sh
features: show version number of the Python interpreter
[bup.git] / t / test-import-duplicity.sh
index 7e41f3fb0959052e9462452e57fdd75b19380b90..74aabc69e7234fdc894f8e45e3dfc6b4a5cdea02 100755 (executable)
@@ -3,31 +3,49 @@
 
 set -o pipefail
 
-top="$(WVPASS pwd)" || exit $?
-tmpdir="$(WVPASS wvmktempdir)" || exit $?
-
-export BUP_DIR="$tmpdir/bup"
-export GIT_DIR="$tmpdir/bup"
-
-bup() { "$top/bup" "$@"; }
-
 if ! [ "$(type -p duplicity)" != "" ]; then
     # FIXME: add WVSKIP.
     echo "Cannot find duplicity; skipping test)" 1>&2
     exit 0
 fi
 
-export PASSPHRASE=bup_duplicity_passphrase
-D=duplicity.tmp
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
+bup() { "$top/bup" "$@"; }
+dup() { duplicity --archive-dir "$tmpdir/dup-cache" "$@"; }
+
 WVSTART "import-duplicity"
+WVPASS "$top/t/sync-tree" "$top/t/sampledata/" "$tmpdir/src/"
+
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+export PASSPHRASE=bup_duplicity_passphrase
+
 WVPASS bup init
 WVPASS cd "$tmpdir"
 WVPASS mkdir duplicity
-WVPASS duplicity "$top/Documentation" "file://duplicity"
+WVPASS dup src file://duplicity
 WVPASS bup tick
-WVPASS duplicity "$top/Documentation" "file://duplicity"
+WVPASS touch src/new-file
+WVPASS dup src file://duplicity
 WVPASS bup import-duplicity "file://duplicity" import-duplicity
-WVPASSEQ "$(bup ls import-duplicity/ | wc -l)" "3"
-WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls $top/Documentation | sort)"
+WVPASSEQ $(bup ls import-duplicity/ | wc -l) 3
+WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls src | sort)"
+WVPASS bup restore -C restore/ import-duplicity/latest/
+WVFAIL "$top/t/compare-trees" src/ restore/ > tmp-compare-trees
+WVPASSEQ $(cat tmp-compare-trees | wc -l) 4
+# Note: OS X rsync itemize output is currently only 9 chars, not 11.
+# Expect something like this (without the leading spaces):
+#   .d..t...... ./
+#   .L..t...... abs-symlink -> /home/foo/bup/t/sampledata/var/abs-symlink-target
+#   .L..t...... b -> a
+#   .L..t...... c -> b
+expected_diff_rx='^\.d\.\.t.\.\.\.\.?\.? \./$|^\.L\.\.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 -rf "$tmpdir"