]> arthur.barton.de Git - bup.git/commitdiff
test-import-duplicity: use install tree for data
authorRob Browning <rlb@defaultvalue.org>
Mon, 9 Mar 2015 01:59:06 +0000 (20:59 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 9 Mar 2015 01:59:24 +0000 (20:59 -0500)
Use a stable "make install" tree for the backup data, and test the
restoration via compare-trees instead of diff.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/test-import-duplicity.sh

index 2ae638b2a5849295e8bb24702a0c54d5a76a175e..8931c084ca64733ce7299452a4857d4fbc3e767e 100755 (executable)
@@ -3,36 +3,44 @@
 
 set -o pipefail
 
-top="$(WVPASS pwd)" || exit $?
-tmpdir="$(WVPASS wvmktempdir)" || exit $?
-
-export BUP_DIR="$tmpdir/bup"
-export GIT_DIR="$tmpdir/bup"
-
 if ! [ "$(type -p duplicity)" != "" ]; then
     # FIXME: add WVSKIP.
     echo "Cannot find duplicity; skipping test)" 1>&2
     exit 0
 fi
 
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
 bup() { "$top/bup" "$@"; }
+dup() { duplicity --archive-dir "$tmpdir/dup-cache" "$@"; }
 
-export PASSPHRASE=bup_duplicity_passphrase
-D=duplicity.tmp
 WVSTART "import-duplicity"
-WVPASS bup init
-WVPASS cd "$tmpdir"
+WVPASS make install DESTDIR="$tmpdir/src"
 
-dup() { duplicity --archive-dir "$tmpdir/dup-cache" "$@"; }
+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 dup "$top/lib" file://duplicity
+WVPASS dup src file://duplicity
 WVPASS bup tick
-WVPASS dup "$top/lib" 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/lib" | sort)"
+WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls src | sort)"
 WVPASS bup restore -C restore/ import-duplicity/latest/
-WVPASS diff -ruN "$top/lib" restore
+WVFAIL "$top/t/compare-trees" src/ restore/ > tmp-compare-trees
+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 -rf "$tmpdir"