[PATCH 7/8] rm: test --unsafe arg

0 views
Skip to first unread message

Rob Browning

unread,
Mar 27, 2026, 7:09:05 PM (12 days ago) Mar 27
to bup-...@googlegroups.com
Signed-off-by: Rob Browning <r...@defaultvalue.org>
---
test/ext/test-rm | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/test/ext/test-rm b/test/ext/test-rm
index e84589bd..fcae8ed6 100755
--- a/test/ext/test-rm
+++ b/test/ext/test-rm
@@ -18,6 +18,10 @@ WVPASS bup init
WVPASS cd "$tmpdir"


+WVFAIL eval 'bup rm --unsafe 2> >(tee log)'
+WVPASS grep -F 'no paths specified' log
+
+
WVSTART "rm /foo (lone branch)"
WVPASS mkdir src src/foo
WVPASS echo twisty-maze > src/1
--
2.47.3

Rob Browning

unread,
Mar 27, 2026, 7:09:05 PM (12 days ago) Mar 27
to bup-...@googlegroups.com
Add some additional tests, particularly for some invalid invocations,
and treat invalid cli arguments handled by parse_num as misuses, not
as an unexpected error (with a backtrace).

Pushed to main.

--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Rob Browning

unread,
Mar 27, 2026, 7:09:05 PM (12 days ago) Mar 27
to bup-...@googlegroups.com
Cover some additional error cases.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---
test/ext/test-misc | 13 -------------
test/ext/test-tag | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 13 deletions(-)
create mode 100755 test/ext/test-tag

diff --git a/test/ext/test-misc b/test/ext/test-misc
index bd60431a..1f70eb57 100755
--- a/test/ext/test-misc
+++ b/test/ext/test-misc
@@ -94,19 +94,6 @@ WVPASSEQ "$(cat $D/f.new{,} | sha1sum)" "$(sha1sum <$D/f2.new)"
WVPASSEQ "$(sha1sum <$D/a)" "$(sha1sum <$D/a.new)"


-WVSTART "tag"
-WVFAIL bup tag -d v0.n 2>/dev/null
-WVFAIL bup tag v0.n non-existant 2>/dev/null
-WVPASSEQ "$(bup tag)" ""
-WVPASS bup tag v0.1 main
-WVPASSEQ "$(bup tag)" "v0.1"
-WVFAIL bup tag v0.1 main
-WVPASS bup tag -f v0.1 main
-WVPASS bup tag -d v0.1
-WVPASS bup tag -f -d v0.1
-WVFAIL bup tag -d v0.1
-
-
WVSTART "indexfile"
D=indexfile.tmp
INDEXFILE=tmpindexfile.tmp
diff --git a/test/ext/test-tag b/test/ext/test-tag
new file mode 100755
index 00000000..12dbc1a4
--- /dev/null
+++ b/test/ext/test-tag
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+. ./wvtest-bup.sh
+. ./test/lib/btl.sh
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+WVPASS bup init
+WVPASS cd "$tmpdir"
+
+WVPASS bup index "$top/test/sampledata"
+WVPASS bup save -n main "$top/test/sampledata"
+WVPASSEQ "$(git tag)" ''
+WVFAIL eval 'bup tag -d nope 2> >(tee log)'
+WVPASS grep "error: tag 'nope' doesn't exist" log
+WVPASSEQ "$(git tag)" ''
+WVPASS bup tag -f -d nope
+WVPASSEQ "$(git tag)" ''
+WVFAIL bup tag tag-1
+WVPASSEQ "$(git tag)" ''
+WVFAIL bup tag '' nope
+WVPASSEQ "$(git tag)" ''
+WVFAIL eval 'bup tag tag-1 nope 2> >(tee log)'
+WVPASS grep "error: commit nope not found" log
+WVPASSEQ "$(git tag)" ''
+WVFAIL eval 'bup tag .tag-1 main 2> >(tee log)'
+WVPASS grep "'.tag-1' is not a valid tag name" log
+WVPASSEQ "$(git tag)" ''
+WVPASS bup tag tag-1 main
+WVPASSEQ "$(git tag)" tag-1
+WVFAIL bup tag tag-1 main 2> log
+WVPASS grep -E "tag 'tag-1' already exists" log
+WVPASSEQ "$(git tag)" tag-1
+WVPASS bup tag -d tag-1
+WVPASSEQ "$(git tag)" ''
+
+WVPASS cd "$top"
+WVPASS rm -rf "$tmpdir"
--
2.47.3

Reply all
Reply to author
Forward
0 new messages