]> arthur.barton.de Git - bup.git/commitdiff
Add initial test-list-idx.sh
authorRob Browning <rlb@defaultvalue.org>
Sat, 9 Jan 2016 21:45:01 +0000 (15:45 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 17 Jan 2016 16:47:20 +0000 (10:47 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Makefile
t/test-list-idx.sh [new file with mode: 0755]

index e4590e5b0c228d7c33eed11160d78c9667be9922..410613f793983211facb0938fe97f7f4b7496e36 100644 (file)
--- 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 (executable)
index 0000000..276416f
--- /dev/null
@@ -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"