Files
rsync/testsuite/mkpath.test
a1346054 dde4695136 Minor cleanup (#214)
- use `grep -E` and `grep -F` (`egrep` and `fgrep` are non-standard)
- use same hashbang style for all test scripts
- use explicit comparisons in test scripts
- remove redundant ; from test scripts
- make test script not executable, just like all the other scripts
- unify codestyle across all test scripts
- make openssl license exception clearer by having it at the top
- use modern links in COPYING. The text now matches:
  https://www.gnu.org/licenses/gpl-3.0.txt
- fix typo
2021-09-26 16:57:55 -07:00

48 lines
1.4 KiB
Bash

#!/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