X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=t%2Ftest-on.sh;h=24c2c383511363941c1ab263ef2836a56d0c55f2;hb=57aaebfd07e7f35aed2ebd44191669b1d9db49df;hp=9064676981bf78b15b9c44d5c26e2675e572773b;hpb=b47b97112cfe42628b123a8303992df3ffe0d6fe;p=bup.git diff --git a/t/test-on.sh b/t/test-on.sh index 9064676..24c2c38 100755 --- a/t/test-on.sh +++ b/t/test-on.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -. ./wvtest-bup.sh -. ./lib.sh +. ./wvtest-bup.sh || exit $? +. ./t/lib.sh || exit $? set -o pipefail @@ -21,14 +21,38 @@ WVPASS mkdir src src/foo WVPASS date > src/bar WVPASS bup random 1k > src/baz WVPASS bup on - index src -WVPASS bup on - save -n src src +WVPASS bup on - save -ctn src src > get.log +WVPASSEQ $(WVPASS cat get.log | WVPASS wc -l) 2 +tree_id=$(WVPASS awk 'FNR == 1' get.log) || exit $? +commit_id=$(WVPASS awk 'FNR == 2' get.log) || exit $? +WVPASS git ls-tree "$tree_id" +WVPASS git cat-file commit "$commit_id" | head -n 1 \ + | WVPASS grep "^tree $tree_id\$" + WVPASS bup restore -C restore "src/latest/$(pwd)/src/." WVPASS compare-trees src/ restore/ WVPASS rm -r restore WVSTART "split" -WVPASS bup on - split -n baz src/baz +WVPASS bup on - split -ctn baz src/baz > get.log +tree_id=$(WVPASS awk 'FNR == 1' get.log) || exit $? +commit_id=$(WVPASS awk 'FNR == 2' get.log) || exit $? +WVPASS git ls-tree "$tree_id" +WVPASS git cat-file commit "$commit_id" | head -n 1 \ + | WVPASS grep "^tree $tree_id\$" WVPASS bup join baz > restore-baz WVPASS cmp src/baz restore-baz +WVSTART "index-cache" +# the 'a-zA-Z0-9_' is '\w' from python, +# the trailing _ is because there's no dir specified +# and that should thus be empty +hostname=$(bup python -c "from bup import helpers ; print(helpers.hostname().decode('iso8859-1'))") +idxcache=$(echo "$hostname" | sed 's/[^@a-zA-Z0-9_]/_/g')_ +# there should be an index-cache now +for idx in "$tmpdir"/bup/objects/pack/*.idx ; do + cachedidx="$tmpdir/bup/index-cache/$idxcache/$(basename "$idx")" + WVPASS cmp "$idx" "$cachedidx" +done + WVPASS rm -rf "$tmpdir"