]> arthur.barton.de Git - bup.git/blob - t/test.sh
Start using wvtest.sh for shell-based tests in test-sh.
[bup.git] / t / test.sh
1 #!/bin/bash
2 . wvtest.sh
3 #set -e
4
5 TOP="$(pwd)"
6 export BUP_DIR="$TOP/buptest.tmp"
7
8 bup()
9 {
10     "$TOP/bup" "$@"
11 }
12
13 WVSTART "init"
14
15 #set -x
16 rm -rf "$BUP_DIR"
17 WVPASS bup init
18
19 WVSTART "split"
20
21 WVPASS bup split --bench -b <testfile1 >tags1.tmp
22 WVPASS bup split -vvvv -b testfile2 >tags2.tmp
23 WVPASS bup split -t testfile2 >tags2t.tmp
24 WVPASS bup split -t testfile2 --fanout 3 >tags2tf.tmp
25 WVPASS bup split -r "$BUP_DIR" -c testfile2 >tags2c.tmp
26 WVPASS ls -lR \
27    | WVPASS bup split -r "$BUP_DIR" -c --fanout 3 --max-pack-objects 3 -n lslr
28 WVFAIL diff -u tags1.tmp tags2.tmp
29
30 # fanout must be different from non-fanout
31 WVFAIL diff -q tags2t.tmp tags2tf.tmp
32 wc -c testfile1 testfile2
33 wc -l tags1.tmp tags2.tmp
34
35 WVSTART "join"
36 WVPASS bup join $(cat tags1.tmp) >out1.tmp
37 WVPASS bup join <tags2.tmp >out2.tmp
38 WVPASS bup join <tags2t.tmp >out2t.tmp
39 WVPASS bup join -r "$BUP_DIR" <tags2c.tmp >out2c.tmp
40 WVPASS diff -u testfile1 out1.tmp
41 WVPASS diff -u testfile2 out2.tmp
42 WVPASS diff -u testfile2 out2t.tmp
43 WVPASS diff -u testfile2 out2c.tmp
44
45 WVSTART "save/fsck"
46 (
47     set -e
48     cd "$BUP_DIR" || exit 1
49     #git repack -Ad
50     #git prune
51     (cd "$TOP/t/sampledata" && WVPASS bup save -vvn master .) || WVFAIL
52     n=$(git fsck --full --strict 2>&1 | 
53           egrep -v 'dangling (commit|tree)' |
54           tee -a /dev/stderr | 
55           wc -l)
56     WVPASS [ "$n" -eq 0 ]
57 ) || exit 1