]> arthur.barton.de Git - bup.git/blob - t/test-import-duplicity.sh
8931c084ca64733ce7299452a4857d4fbc3e767e
[bup.git] / t / test-import-duplicity.sh
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh || exit $?
3
4 set -o pipefail
5
6 if ! [ "$(type -p duplicity)" != "" ]; then
7     # FIXME: add WVSKIP.
8     echo "Cannot find duplicity; skipping test)" 1>&2
9     exit 0
10 fi
11
12 top="$(WVPASS pwd)" || exit $?
13 tmpdir="$(WVPASS wvmktempdir)" || exit $?
14
15 bup() { "$top/bup" "$@"; }
16 dup() { duplicity --archive-dir "$tmpdir/dup-cache" "$@"; }
17
18 WVSTART "import-duplicity"
19 WVPASS make install DESTDIR="$tmpdir/src"
20
21 export BUP_DIR="$tmpdir/bup"
22 export GIT_DIR="$tmpdir/bup"
23 export PASSPHRASE=bup_duplicity_passphrase
24
25 WVPASS bup init
26 WVPASS cd "$tmpdir"
27 WVPASS mkdir duplicity
28 WVPASS dup src file://duplicity
29 WVPASS bup tick
30 WVPASS touch src/new-file
31 WVPASS dup src file://duplicity
32 WVPASS bup import-duplicity "file://duplicity" import-duplicity
33 WVPASSEQ "$(bup ls import-duplicity/ | wc -l)" "3"
34 WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls src | sort)"
35 WVPASS bup restore -C restore/ import-duplicity/latest/
36 WVFAIL "$top/t/compare-trees" src/ restore/ > tmp-compare-trees
37 WVPASSEQ $(cat tmp-compare-trees | wc -l) 1
38 # Note: OS X rsync itemize output is currently only 9 chars, not 11.
39 expected_diff_rx='^\.d\.\.t.\.\.\.\.?\.? \./$'
40 if ! grep -qE "$expected_diff_rx" tmp-compare-trees; then
41     echo -n 'tmp-compare-trees: ' 1>&2
42     cat tmp-compare-trees 1>&2
43 fi
44 WVPASS grep -qE "$expected_diff_rx" tmp-compare-trees
45
46 WVPASS rm -rf "$tmpdir"