]> arthur.barton.de Git - bup.git/commitdiff
test: test index vs. save file type change
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 1 Jan 2021 10:04:59 +0000 (11:04 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sat, 15 May 2021 18:57:24 +0000 (13:57 -0500)
In this case, the item shouldn't be recorded at all.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
test/ext/test-index-save-type-change [new file with mode: 0755]

diff --git a/test/ext/test-index-save-type-change b/test/ext/test-index-save-type-change
new file mode 100755 (executable)
index 0000000..4841fb1
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+. wvtest.sh
+. wvtest-bup.sh
+. dev/lib.sh
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+export BUP_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+WVPASS cd "$tmpdir"
+
+WVPASS bup init
+WVPASS mkdir "$tmpdir/save"
+
+WVSTART "index vs. save file type change"
+
+# index a (dead) symlink
+WVPASS ln -s asdf "$tmpdir/save/test"
+WVPASS bup index "$tmpdir/save"
+
+WVPASS rm -f "$tmpdir/save/test"
+WVPASS echo now-a-regular-file > "$tmpdir/save/test"
+
+# this should now log an error
+WVFAIL bup save -n test "$tmpdir/save"
+
+# can list the folder but it's empty
+WVPASS bup ls -ls "test/latest/$tmpdir/save/"
+WVPASSEQ "$(bup ls -ls "test/latest/$tmpdir/save/")" ""
+
+WVPASS rm -rf "$tmpdir"