[PATCH 08/17] test-misc: test an external command (import-rsnapshot) with tty

0 views
Skip to first unread message

Rob Browning

unread,
Nov 8, 2025, 4:39:01 PM (6 days ago) Nov 8
to bup-...@googlegroups.com
In some versions of 0.33.x any external/subprocess commands like
import-rdiff-backup would crash when isatty. That code no longer
exists, but add the related test to guard against regressions.

Adjust the import-rsnapshot tests in test-misc to expose the original
problem by running the subcommand with a tty via with-tty.

cf.

main: fix filter_output with subprocess subcommands
5618972a4f2f859aec189f768ff5da9f54c67f64

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---
test/ext/test-misc | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/test/ext/test-misc b/test/ext/test-misc
index 60427429..bd60431a 100755
--- a/test/ext/test-misc
+++ b/test/ext/test-misc
@@ -13,6 +13,7 @@ export GIT_DIR="$tmpdir/bup"

bup() { "$top/bup" "$@"; }
sha1sum() { "$top/dev/checksum" -t sha1 "$@"; }
+with-tty() { "$top/dev/with-tty" "$@"; }

WVPASS cd "$tmpdir"

@@ -129,6 +130,9 @@ b"


WVSTART "import-rsnapshot"
+# NOTE: if this test is made optional, say if it eventually depends on
+# rsnapshot being installed, we might want to add other "interactive
+# external command" tests (see script below) to maintain coverage.
export BUP_DIR="$tmpdir/rsnapshot/.bup"
WVPASS rm -rf rsnapshot
WVPASS mkdir rsnapshot
@@ -140,6 +144,15 @@ WVPASS touch rsnapshot/hourly.0/buptest/c/d/e
WVPASS bup import-rsnapshot rsnapshot/
WVPASSEQ "$(bup ls -F buptest/latest/)" "a/
c/"
+if ! with-tty true; then
+ WVSKIP 'Skipping interactive import-snapshot test (no supported script command)'
+else
+ WVPASS rm -rf "$BUP_DIR"
+ WVPASS bup init
+ WVPASS with-tty "$top/bup" import-rsnapshot rsnapshot/
+ WVPASSEQ "$(bup ls -F buptest/latest/)" "a/
+c/"
+fi
WVPASS rm -rf rsnapshot


--
2.47.3

Reply all
Reply to author
Forward
0 new messages