From: Rob Browning Date: Sat, 9 Jan 2016 21:45:01 +0000 (-0600) Subject: Add initial test-list-idx.sh X-Git-Tag: 0.28-rc1~32 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=3b470fc212045656fa3f565862785139e1d336b2 Add initial test-list-idx.sh Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/Makefile b/Makefile index e4590e5..410613f 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,7 @@ runtests-python: all t/tmp cmdline_tests := \ t/test-main.sh \ + t/test-list-idx.sh \ t/test-index.sh \ t/test-split-join.sh \ t/test-fuse.sh \ diff --git a/t/test-list-idx.sh b/t/test-list-idx.sh new file mode 100755 index 0000000..276416f --- /dev/null +++ b/t/test-list-idx.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +. wvtest-bup.sh || exit $? +. t/lib.sh || exit $? + +set -o pipefail + +TOP="$(WVPASS pwd)" || exit $? +tmpdir="$(WVPASS wvmktempdir)" || exit $? +export BUP_DIR="$tmpdir/bup" + +bup() +{ + "$TOP/bup" "$@" +} + +WVSTART 'bup list-idx' + +WVPASS bup init +WVPASS cd "$tmpdir" +WVPASS mkdir src +WVPASS bup random 1k > src/data +WVPASS bup index src +WVPASS bup save -n src src +WVPASS bup list-idx "$BUP_DIR"/objects/pack/*.idx +hash1="$(WVPASS bup list-idx "$BUP_DIR"/objects/pack/*.idx)" || exit $? +hash1="${hash1##* }" +WVPASS bup list-idx --find "${hash1}" "$BUP_DIR"/objects/pack/*.idx \ + > list-idx.log || exit $? +found="$(cat list-idx.log)" || exit $? +found="${found##* }" +WVPASSEQ "$found" "$hash1" +WVPASSEQ "$(wc -l < list-idx.log | tr -d ' ')" 1 + +WVPASS rm -r "$tmpdir"