8 top="$(WVPASS /bin/pwd)" || exit $?
9 tmpdir="$(WVPASS wvmktempdir)" || exit $?
10 export BUP_DIR="$tmpdir/bup"
12 bup() { "$top/bup" "$@"; }
21 WVPASS force-delete $D
24 WVPASS bup random 128k >$D/b
25 WVPASS mkdir $D/d $D/d/e
26 WVPASS bup random 512 >$D/f
33 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
34 WVPASS rm "$BUP_DIR"/objects/pack/bup.bloom
36 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
37 WVPASS bup bloom -d "$BUP_DIR"/objects/pack --ruin --force
38 WVFAIL bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
39 WVPASS bup bloom --force -k 5
40 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
43 WVPASS bup memtest -c1 -n100
44 WVPASS bup memtest -c1 -n100 --existing
46 WVSTART "save/git-fsck"
51 WVPASS bup random 4k | WVPASS bup split -b
52 (WVPASS cd "$top/t/sampledata" && WVPASS bup save -vvn master /) || exit $?
53 result="$(git fsck --full --strict 2>&1)" || exit $?
55 WVFAIL egrep -v 'dangling (commit|tree|blob)' |
56 WVPASS tee -a /dev/stderr |
57 WVPASS wc -l) || exit $?
62 WVPASS force-delete buprestore.tmp
63 WVFAIL bup restore boink
64 WVPASS touch "$tmpdir/$D/$D"
65 WVPASS bup index -u "$tmpdir/$D"
66 WVPASS bup save -n master /
67 WVPASS bup restore -C buprestore.tmp "/master/latest/$tmpdir/$D"
68 WVPASSEQ "$(ls buprestore.tmp)" "bupdata.tmp"
69 WVPASS force-delete buprestore.tmp
70 WVPASS bup restore -C buprestore.tmp "/master/latest/$tmpdir/$D/"
71 WVPASS touch $D/non-existent-file buprestore.tmp/non-existent-file # else diff fails
72 WVPASS diff -ur $D/ buprestore.tmp/
73 WVPASS force-delete buprestore.tmp
74 WVPASS echo -n "" | WVPASS bup split -n split_empty_string.tmp
75 WVPASS bup restore -C buprestore.tmp split_empty_string.tmp/latest/
76 WVPASSEQ "$(cat buprestore.tmp/data)" ""
80 WVPASS force-delete $tmp
82 export BUP_DIR="$(pwd)/$tmp/bup"
83 WVPASS WVPASS bup init
84 WVPASS mkdir -p $tmp/src/x/y/z
85 WVPASS bup random 8k > $tmp/src/x/y/random-1
86 WVPASS bup random 8k > $tmp/src/x/y/z/random-2
87 WVPASS bup index -u $tmp/src
88 WVPASS bup save --strip -n foo $tmp/src
90 WVSTART "restore /foo/latest"
91 WVPASS bup restore -C $tmp/restore /foo/latest
92 WVPASS "$top/t/compare-trees" $tmp/src/ $tmp/restore/latest/
94 WVSTART "restore /foo/latest/"
95 WVPASS force-delete "$tmp/restore"
96 WVPASS bup restore -C $tmp/restore /foo/latest/
97 for x in $tmp/src/*; do
98 WVPASS "$top/t/compare-trees" $x/ $tmp/restore/$(basename $x);
101 WVSTART "restore /foo/latest/."
102 WVPASS force-delete "$tmp/restore"
103 WVPASS bup restore -C $tmp/restore /foo/latest/.
104 WVPASS "$top/t/compare-trees" $tmp/src/ $tmp/restore/
106 WVSTART "restore /foo/latest/x"
107 WVPASS force-delete "$tmp/restore"
108 WVPASS bup restore -C $tmp/restore /foo/latest/x
109 WVPASS "$top/t/compare-trees" $tmp/src/x/ $tmp/restore/x/
111 WVSTART "restore /foo/latest/x/"
112 WVPASS force-delete "$tmp/restore"
113 WVPASS bup restore -C $tmp/restore /foo/latest/x/
114 for x in $tmp/src/x/*; do
115 WVPASS "$top/t/compare-trees" $x/ $tmp/restore/$(basename $x);
118 WVSTART "restore /foo/latest/x/."
119 WVPASS force-delete "$tmp/restore"
120 WVPASS bup restore -C $tmp/restore /foo/latest/x/.
121 WVPASS "$top/t/compare-trees" $tmp/src/x/ $tmp/restore/
126 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/b" >$D/b.new
127 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/f" >$D/f.new
128 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/f"{,} >$D/f2.new
129 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/a" >$D/a.new
130 WVPASSEQ "$(sha1sum <$D/b)" "$(sha1sum <$D/b.new)"
131 WVPASSEQ "$(sha1sum <$D/f)" "$(sha1sum <$D/f.new)"
132 WVPASSEQ "$(cat $D/f.new{,} | sha1sum)" "$(sha1sum <$D/f2.new)"
133 WVPASSEQ "$(sha1sum <$D/a)" "$(sha1sum <$D/a.new)"
136 WVFAIL bup tag -d v0.n 2>/dev/null
137 WVFAIL bup tag v0.n non-existant 2>/dev/null
138 WVPASSEQ "$(bup tag)" ""
139 WVPASS bup tag v0.1 master
140 WVPASSEQ "$(bup tag)" "v0.1"
141 WVFAIL bup tag v0.1 master
142 WVPASS bup tag -f v0.1 master
143 WVPASS bup tag -d v0.1
144 WVPASS bup tag -f -d v0.1
145 WVFAIL bup tag -d v0.1
148 WVSTART "save (no index)"
150 tmp=save-no-index.tmp
151 WVPASS force-delete $tmp
153 export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
155 WVFAIL bup save -n nothing /
161 INDEXFILE=tmpindexfile.tmp
162 WVPASS rm -f $INDEXFILE
163 WVPASS force-delete $D
165 export BUP_DIR="$D/.bup"
170 WVPASS bup index -ux $D
171 WVPASS bup save --strip -n bupdir $D
172 WVPASSEQ "$(bup ls -F bupdir/latest/)" "a
175 WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
176 WVPASS bup save --strip -n indexfile -f $INDEXFILE $D
177 WVPASSEQ "$(bup ls indexfile/latest/)" "a
181 WVSTART "import-rsnapshot"
183 export BUP_DIR="$tmpdir/$D/.bup"
184 WVPASS force-delete $D
187 WVPASS mkdir -p $D/hourly.0/buptest/a
188 WVPASS touch $D/hourly.0/buptest/a/b
189 WVPASS mkdir -p $D/hourly.0/buptest/c/d
190 WVPASS touch $D/hourly.0/buptest/c/d/e
192 WVPASS bup import-rsnapshot $D/
193 WVPASSEQ "$(bup ls -F buptest/latest/)" "a/
197 WVSTART "save disjoint top-level directories"
199 # Resolve any symlinks involving the top top-level dirs.
200 real_pwd="$(WVPASS realpath .)" || exit $?
201 real_tmp="$(WVPASS realpath /tmp/.)" || exit $?
202 pwd_top="$(echo $real_pwd | WVPASS awk -F "/" '{print $2}')" || exit $?
203 tmp_top="$(echo $real_tmp | WVPASS awk -F "/" '{print $2}')" || exit $?
205 if [ "$pwd_top" = "$tmp_top" ]; then
206 echo "(running from within /$tmp_top; skipping test)" 1>&2
210 WVPASS force-delete $D
213 tmpdir2="$(WVPASS mktemp -d $real_tmp/bup-test-XXXXXXX)" || exit $?
214 cleanup() { WVPASS rm -r "$tmpdir2"; }
215 WVPASS trap cleanup EXIT
216 WVPASS date > "$tmpdir2/2"
218 export BUP_DIR="$tmpdir/bup"
219 WVPASS test -d "$BUP_DIR" && WVPASS rm -r "$BUP_DIR"
222 WVPASS bup index -vu $(pwd)/$D/x "$tmpdir2"
223 WVPASS bup save -t -n src $(pwd)/$D/x "$tmpdir2"
225 # For now, assume that "ls -a" and "sort" use the same order.
226 actual="$(WVPASS bup ls -AF src/latest)" || exit $?
227 expected="$(echo -e "$pwd_top/\n$tmp_top/" | WVPASS sort)" || exit $?
228 WVPASSEQ "$actual" "$expected"
231 WVPASS rm -rf "$tmpdir"