6 export BUP_DIR="$TOP/buptest.tmp"
23 WVPASSEQ "$(bup index --check -p)" ""
24 WVPASSEQ "$(bup index --check -p $D)" ""
26 WVFAIL bup index --check -u $D.fake
27 WVPASS bup index --check -u $D
28 WVPASSEQ "$(bup index --check -p $D)" "$D/"
30 WVPASS bup random 128k >$D/b
32 WVPASS bup random 512 >$D/f
33 WVPASSEQ "$(bup index -s $D/)" "A $D/"
34 WVPASSEQ "$(bup index -s $D/b)" ""
35 WVPASSEQ "$(bup index --check -us $D/b)" "A $D/b"
36 WVPASSEQ "$(bup index --check -us $D/b $D/d)" \
42 WVPASSEQ "$(bup index --check -usx $D)" \
50 WVPASSEQ "$(bup index --check -us $D/a $D/b --fake-valid)" \
53 WVPASSEQ "$(bup index --check -us $D/a)" " $D/a" # stays unmodified
54 WVPASSEQ "$(bup index --check -us $D/d --fake-valid)" \
59 WVPASS bup index -u $D/d/z # becomes modified
60 WVPASSEQ "$(bup index -s $D/a $D $D/b)" \
69 WVPASS bup index -u $D/d/e $D/a --fake-invalid
70 WVPASSEQ "$(cd $D && bup index -m .)" \
77 WVPASSEQ "$(cd $D && bup index -m)" \
84 WVPASSEQ "$(cd $D && bup index -s .)" "$(cd $D && bup index -s .)"
86 WVFAIL bup save -t $D/doesnt-exist-filename
88 mv $BUP_DIR/bupindex $BUP_DIR/bi.old
89 WVFAIL bup save -t $D/d/e/fifotest
90 mkfifo $D/d/e/fifotest
91 WVPASS bup index -u $D/d/e/fifotest
92 WVFAIL bup save -t $D/d/e/fifotest
93 WVFAIL bup save -t $D/d/e
95 WVPASS bup index -u $D/d/e
96 WVFAIL bup save -t $D/d/e/fifotest
97 mv $BUP_DIR/bi.old $BUP_DIR/bupindex
99 WVPASS bup index -u $D/d/e
100 WVPASS bup save -t $D/d/e
101 WVPASSEQ "$(cd $D && bup index -m)" \
107 WVPASS bup save -t $D/d
108 WVPASSEQ "$(cd $D && bup index -m)" \
112 tree1=$(bup save -t $D)
113 WVPASSEQ "$(cd $D && bup index -m)" ""
114 tree2=$(bup save -t $D)
115 WVPASSEQ "$tree1" "$tree2"
116 WVPASSEQ "$(bup index -s / | grep ^D)" ""
117 tree3=$(bup save -t /)
118 WVPASSEQ "$tree1" "$tree3"
119 WVPASS bup save -r :$BUP_DIR -n r-test $D
120 WVFAIL bup save -r :$BUP_DIR/fake/path -n r-test $D
121 WVFAIL bup save -r :$BUP_DIR -n r-test $D/fake/path
126 WVPASS bup split -b a.tmp >taga.tmp
127 WVPASS bup split -b b.tmp >tagb.tmp
128 cat a.tmp b.tmp | WVPASS bup split -b >tagab.tmp
129 WVPASSEQ $(cat taga.tmp | wc -l) 1
130 WVPASSEQ $(cat tagb.tmp | wc -l) 1
131 WVPASSEQ $(cat tagab.tmp | wc -l) 1
132 WVPASSEQ $(cat tag[ab].tmp | wc -l) 2
133 WVPASSEQ "$(bup split -b a.tmp b.tmp)" "$(cat tagab.tmp)"
134 WVPASSEQ "$(bup split -b --keep-boundaries a.tmp b.tmp)" "$(cat tag[ab].tmp)"
135 WVPASSEQ "$(cat tag[ab].tmp | bup split -b --keep-boundaries --git-ids)" \
137 WVPASSEQ "$(cat tag[ab].tmp | bup split -b --git-ids)" \
139 WVPASS bup split --bench -b <t/testfile1 >tags1.tmp
140 WVPASS bup split -vvvv -b t/testfile2 >tags2.tmp
144 WVPASS bup split -t t/testfile2 >tags2t.tmp
145 WVPASS bup split -t t/testfile2 --fanout 3 >tags2tf.tmp
146 WVPASS bup split -r "$BUP_DIR" -c t/testfile2 >tags2c.tmp
147 WVPASS bup split -r :$BUP_DIR -c t/testfile2 >tags2c.tmp
149 | WVPASS bup split -r :$BUP_DIR -c --fanout 3 --max-pack-objects 3 -n lslr
151 WVFAIL bup ls /does-not-exist
153 #WVPASS bup ls /lslr/1971-01-01 # all dates always exist
154 WVFAIL diff -u tags1.tmp tags2.tmp
156 # fanout must be different from non-fanout
157 WVFAIL diff -q tags2t.tmp tags2tf.tmp
158 wc -c t/testfile1 t/testfile2
159 wc -l tags1.tmp tags2.tmp
161 WVPASS bup memtest -c1 -n100
162 WVPASS bup memtest -c1 -n100 --existing
165 WVPASS bup join $(cat tags1.tmp) >out1.tmp
166 WVPASS bup join <tags2.tmp >out2.tmp
167 WVPASS bup join <tags2t.tmp >out2t.tmp
168 WVPASS bup join -r "$BUP_DIR" <tags2c.tmp >out2c.tmp
169 WVPASS bup join -r ":$BUP_DIR" <tags2c.tmp >out2c.tmp
170 WVPASS diff -u t/testfile1 out1.tmp
171 WVPASS diff -u t/testfile2 out2.tmp
172 WVPASS diff -u t/testfile2 out2t.tmp
173 WVPASS diff -u t/testfile2 out2c.tmp
175 WVSTART "save/git-fsck"
178 cd "$BUP_DIR" || exit 1
181 (cd "$TOP/t/sampledata" && WVPASS bup save -vvn master /) || WVFAIL
182 n=$(git fsck --full --strict 2>&1 |
183 egrep -v 'dangling (commit|tree)' |
186 WVPASS [ "$n" -eq 0 ]
190 rm -rf buprestore.tmp
191 WVFAIL bup restore boink
192 WVPASS bup restore -C buprestore.tmp "/master/latest/$TOP/$D"
193 WVPASSEQ "$(ls buprestore.tmp)" "bupdata.tmp"
194 rm -rf buprestore.tmp
195 WVPASS bup restore -C buprestore.tmp "/master/latest/$TOP/$D/"
196 WVPASS diff -ur $D/ buprestore.tmp/
199 WVPASS bup ftp "cat /master/latest/$TOP/$D/b" >$D/b.new
200 WVPASS bup ftp "cat /master/latest/$TOP/$D/f" >$D/f.new
201 WVPASS bup ftp "cat /master/latest/$TOP/$D/f"{,} >$D/f2.new
202 WVPASS bup ftp "cat /master/latest/$TOP/$D/a" >$D/a.new
203 WVPASSEQ "$(sha1sum <$D/b)" "$(sha1sum <$D/b.new)"
204 WVPASSEQ "$(sha1sum <$D/f)" "$(sha1sum <$D/f.new)"
205 WVPASSEQ "$(cat $D/f.new{,} | sha1sum)" "$(sha1sum <$D/f2.new)"
206 WVPASSEQ "$(sha1sum <$D/a)" "$(sha1sum <$D/a.new)"
209 WVFAIL bup tag -d v0.n 2>/dev/null
210 WVFAIL bup tag v0.n non-existant 2>/dev/null
211 WVPASSEQ "$(bup tag)" ""
212 WVPASS bup tag v0.1 master
213 WVPASSEQ "$(bup tag)" "v0.1"
214 WVPASS bup tag -d v0.1
216 # This section destroys data in the bup repository, so it is done last.
219 WVPASS bup fsck --quick
220 if bup fsck --par2-ok; then
221 WVSTART "fsck (par2)"
223 WVSTART "fsck (PAR2 IS MISSING)"
227 WVPASS bup damage $BUP_DIR/objects/pack/*.pack -n10 -s1 -S0
228 WVFAIL bup fsck --quick
229 WVFAIL bup fsck --quick --disable-par2
230 chmod u+w $BUP_DIR/objects/pack/*.idx
231 WVPASS bup damage $BUP_DIR/objects/pack/*.idx -n10 -s1 -S0
232 WVFAIL bup fsck --quick -j4
233 WVPASS bup damage $BUP_DIR/objects/pack/*.pack -n10 -s1024 --percent 0.4 -S0
234 WVFAIL bup fsck --quick
235 WVFAIL bup fsck --quick -rvv -j99 # fails because repairs were needed
236 if bup fsck --par2-ok; then
237 WVPASS bup fsck -r # ok because of repairs from last time
238 WVPASS bup damage $BUP_DIR/objects/pack/*.pack -n202 -s1 --equal -S0
240 WVFAIL bup fsck -rvv # too many errors to be repairable
241 WVFAIL bup fsck -r # too many errors to be repairable
243 WVFAIL bup fsck --quick -r # still fails because par2 was missing
246 WVSTART "exclude-bupdir"
250 export BUP_DIR="$D/.bup"
253 WVPASS bup random 128k >$D/b
255 WVPASS bup random 512 >$D/f
256 WVPASS bup index -ux $D
257 bup save -n exclude-bupdir $D
258 WVPASSEQ "$(bup ls exclude-bupdir/latest/$TOP/$D/)" "a
267 export BUP_DIR="$D/.bup"
270 WVPASS bup random 128k >$D/b
272 WVPASS bup random 512 >$D/f
273 WVPASS bup index -ux --exclude $D/d $D
274 bup save -n exclude $D
275 WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
279 WVPASS bup index -ux --exclude $D/d --exclude $TOP/$D/g --exclude $D/h $D
280 bup save -n exclude $D
281 WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
285 WVSTART "exclude-from"
286 D=exclude-fromdir.tmp
287 EXCLUDE_FILE=exclude-from.tmp
290 $D/h" > $EXCLUDE_FILE
293 export BUP_DIR="$D/.bup"
296 WVPASS bup random 128k >$D/b
298 WVPASS bup random 512 >$D/f
300 WVPASS bup index -ux --exclude-from $EXCLUDE_FILE $D
301 bup save -n exclude-from $D
302 WVPASSEQ "$(bup ls exclude-from/latest/$TOP/$D/)" "a
311 export BUP_DIR="$D/.bup"
314 WVPASS bup random 128k >$D/b
316 WVPASS bup random 512 >$D/f
317 WVPASS bup index -ux $D
318 bup save --strip -n strip $D
319 WVPASSEQ "$(bup ls strip/latest/)" "a
328 export BUP_DIR="$D/.bup"
331 WVPASS bup random 128k >$D/b
333 WVPASS bup random 512 >$D/f
334 WVPASS bup index -ux $D
335 bup save --strip-path $TOP -n strip-path $D
336 WVPASSEQ "$(bup ls strip-path/latest/$D/)" "a
343 INDEXFILE=tmpindexfile.tmp
347 export BUP_DIR="$D/.bup"
352 WVPASS bup index -ux $D
353 bup save --strip -n bupdir $D
354 WVPASSEQ "$(bup ls bupdir/latest/)" "a
357 WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
358 bup save --strip -n indexfile -f $INDEXFILE $D
359 WVPASSEQ "$(bup ls indexfile/latest/)" "a
362 WVSTART "import-rsnapshot"
372 mkdir -p $D/hourly.0/buptest/a
373 touch $D/hourly.0/buptest/a/b
374 mkdir -p $D/hourly.0/buptest/c/d
375 touch $D/hourly.0/buptest/c/d/e
377 bup import-rsnapshot $D/
379 WVPASSEQ "$(bup ls buptest/latest/)" "a/