From 3b470fc212045656fa3f565862785139e1d336b2 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 9 Jan 2016 15:45:01 -0600 Subject: [PATCH] Add initial test-list-idx.sh Signed-off-by: Rob Browning Tested-by: Rob Browning --- Makefile | 1 + t/test-list-idx.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 t/test-list-idx.sh 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" -- 2.39.2