]> arthur.barton.de Git - bup.git/blob - test-sh
cdf94658bc7f3e8de0936d84dd1ecfc93fcc46c3
[bup.git] / test-sh
1 #!/bin/bash
2 set -e
3 echo "Testing \"integration\" in $0:"
4
5 TOP="$(pwd)"
6 export BUP_DIR="$TOP/buptest.tmp"
7
8 bup()
9 {
10     "$TOP/bup" "$@"
11 }
12
13 set -x
14 rm -rf "$BUP_DIR"
15 bup init
16 bup split --bench -b <testfile1 >tags1.tmp
17 bup split -vvvv -b testfile2 >tags2.tmp
18 bup split -t testfile2 >tags2t.tmp
19 bup split -c testfile2 >tags2c.tmp
20 diff -u tags1.tmp tags2.tmp || true
21 wc -c testfile1 testfile2
22 wc -l tags1.tmp tags2.tmp
23 bup join $(cat tags1.tmp) >out1.tmp
24 bup join <tags2.tmp >out2.tmp
25 bup join <tags2t.tmp >out2t.tmp
26 bup join <tags2c.tmp >out2c.tmp
27 diff -u testfile1 out1.tmp
28 diff -u testfile2 out2.tmp
29 diff -u testfile2 out2t.tmp
30 diff -u testfile2 out2c.tmp
31
32 (
33     set -e
34     cd "$BUP_DIR" || exit 1
35     git repack -Ad
36     git prune
37     (cd "$TOP/t/sampledata" && bup save -vvn master .) || exit 1
38     n=$(git fsck --full --strict 2>&1 | 
39           grep -v 'dangling commit' |
40           tee -a /dev/stderr | 
41           wc -l)
42     if [ "$n" != 0 ]; then
43         echo "git fsck error."
44         exit 5
45     fi
46 ) || exit 1