diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 16:14:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 16:14:31 +0000 |
commit | 2d5707c7479eacb3b1ad98e01b53f56a88f8fb78 (patch) | |
tree | d9c334e83692851c02e3e1b8e65570c97bc82481 /testsuite/mkpath.test | |
parent | Initial commit. (diff) | |
download | rsync-2d5707c7479eacb3b1ad98e01b53f56a88f8fb78.tar.xz rsync-2d5707c7479eacb3b1ad98e01b53f56a88f8fb78.zip |
Adding upstream version 3.2.7.upstream/3.2.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/mkpath.test')
-rw-r--r-- | testsuite/mkpath.test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/testsuite/mkpath.test b/testsuite/mkpath.test new file mode 100644 index 0000000..8046345 --- /dev/null +++ b/testsuite/mkpath.test @@ -0,0 +1,47 @@ +#!/bin/sh + +. "$suitedir/rsync.fns" + +makepath "$fromdir" +makepath "$todir" + +cp_p "$srcdir/rsync.h" "$fromdir/text" +cp_p "$srcdir/configure.ac" "$fromdir/extra" + +cd "$tmpdir" + +deep_dir=to/foo/bar/baz/down/deep + +# Check that we can create several levels of dest dir +$RSYNC -aiv --mkpath from/text $deep_dir/new +test -f $deep_dir/new || test_fail "'new' file not found in $deep_dir dir" +rm -rf to/foo + +$RSYNC -aiv --mkpath from/text $deep_dir/ +test -f $deep_dir/text || test_fail "'text' file not found in $deep_dir dir" +rm $deep_dir/text + +# Make sure we can handle an existing path +mkdir $deep_dir/new +$RSYNC -aiv --mkpath from/text $deep_dir/new +test -f $deep_dir/new/text || test_fail "'text' file not found in $deep_dir/new dir" + +# ... and an existing path when an alternate dest filename is specified +$RSYNC -aiv --mkpath from/text $deep_dir/new/text2 +test -f $deep_dir/new/text2 || test_fail "'text2' file not found in $deep_dir/new dir" +rm -rf to/foo + +# Try the tests again with multiple source args +$RSYNC -aiv --mkpath from/ $deep_dir +test -f $deep_dir/extra || test_fail "'extra' file not found in $deep_dir dir" +rm -rf to/foo + +$RSYNC -aiv --mkpath from/ $deep_dir/ +test -f $deep_dir/text || test_fail "'text' file not found in $deep_dir dir" + +# Make sure that we can handle no path +$RSYNC -aiv --mkpath from/text to_text +test -f to_text || test_fail "'to_text' file not found in current dir" + +# The script would have aborted on error, so getting here means we've won. +exit 0 |