]> arthur.barton.de Git - bup.git/blob - t/test-list-idx.sh
test-restore-map-owner: accommodate python 3 and test there
[bup.git] / t / test-list-idx.sh
1 #!/usr/bin/env bash
2 . wvtest-bup.sh || exit $?
3 . t/lib.sh || exit $?
4
5 set -o pipefail
6
7 TOP="$(WVPASS pwd)" || exit $?
8 tmpdir="$(WVPASS wvmktempdir)" || exit $?
9 export BUP_DIR="$tmpdir/bup"
10
11 bup()
12 {
13     "$TOP/bup" "$@"
14 }
15
16 WVSTART 'bup list-idx'
17
18 WVPASS bup init
19 WVPASS cd "$tmpdir"
20 WVPASS mkdir src
21 WVPASS bup random 1k > src/data
22 WVPASS bup index src
23 WVPASS bup save -n src src
24 WVPASS bup list-idx "$BUP_DIR"/objects/pack/*.idx
25 hash1="$(WVPASS bup list-idx "$BUP_DIR"/objects/pack/*.idx)" || exit $?
26 hash1="${hash1##* }"
27 WVPASS bup list-idx --find "${hash1}" "$BUP_DIR"/objects/pack/*.idx \
28        > list-idx.log || exit $?
29 found="$(cat list-idx.log)" || exit $?
30 found="${found##* }"
31 WVPASSEQ "$found" "$hash1"
32 WVPASSEQ "$(wc -l < list-idx.log | tr -d ' ')" 1
33
34 WVPASS rm -r "$tmpdir"