summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2022-01-18 22:43:25 -0800
committerWayne Davison <wayne@opencoder.net>2022-01-18 22:47:05 -0800
commit824a057935ecb0565babc5c865df5906f2637626 (patch)
tree0dcfcf61b18d6ff469ddbd0bade2d4b1166c6d31 /testsuite
parentd91ddb97d1055d0721cb36da47d21a7b85e9d9f9 (diff)
downloadrsync-824a057935ecb0565babc5c865df5906f2637626.tar.gz
Add some arg-escaping tests.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/00-hello.test55
1 files changed, 51 insertions, 4 deletions
diff --git a/testsuite/00-hello.test b/testsuite/00-hello.test
index ed72c0bd..e9477182 100644
--- a/testsuite/00-hello.test
+++ b/testsuite/00-hello.test
@@ -1,9 +1,11 @@
#!/bin/sh
-test_fail() {
- echo "$@" >&2
- exit 1
-}
+# Test some foundational things.
+
+. "$suitedir/rsync.fns"
+
+RSYNC_RSH="$scratchdir/src/support/lsh.sh"
+export RSYNC_RSH
echo $0 running
@@ -12,3 +14,48 @@ $RSYNC --version || test_fail '--version output failed'
$RSYNC --info=help || test_fail '--info=help output failed'
$RSYNC --debug=help || test_fail '--debug=help output failed'
+
+weird_name="A weird)name"
+
+mkdir "$fromdir"
+mkdir "$fromdir/$weird_name"
+
+append_line() {
+ echo "$1"
+ echo "$1" >>"$fromdir/$weird_name/file"
+}
+
+append_line test1
+checkit "$RSYNC -ai '$fromdir/' '$todir/'" "$fromdir" "$todir"
+
+copy_weird() {
+ checkit "$RSYNC $1 \"$2$fromdir/$weird_name/\" \"$3$todir/$weird_name\"" "$fromdir" "$todir"
+}
+
+append_line test2
+copy_weird '-ai' 'lh:' ''
+
+append_line test3
+copy_weird '-ai' '' 'lh:'
+
+append_line test4
+copy_weird '-ais' 'lh:' ''
+
+append_line test5
+copy_weird '-ais' '' 'lh:'
+
+echo test6
+
+touch "$fromdir/one" "$fromdir/two"
+(cd "$fromdir" && $RSYNC -ai --old-args lh:'one two' "$todir/")
+if [ ! -f "$todir/one" ] || [ ! -f "$todir/two" ]; then
+ test_fail "old-args copy of 'one two' failed"
+fi
+
+echo test7
+
+rm "$todir/one" "$todir/two"
+(cd "$fromdir" && RSYNC_OLD_ARGS=1 $RSYNC -ai lh:'one two' "$todir/")
+
+# The script would have aborted on error, so getting here means we've won.
+exit 0