diff options
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 |