3 # Copyright (C) 2004-2022 Wayne Davison
5 # This program is distributable under the terms of the GNU GPL (see
8 # Test that the --backup option works right.
10 .
"$suitedir/rsync.fns"
14 makepath
"$fromdir/deep" "$bakdir/dname"
15 name1
="$fromdir/deep/name1"
16 name2
="$fromdir/deep/name2"
18 cat "$srcdir"/[gr
]*.
[ch
] > "$name1"
19 cat "$srcdir"/[et
]*.
[ch
] > "$name2"
21 checkit
"$RSYNC -ai --info=backup '$fromdir/' '$todir/'" "$fromdir" "$todir"
23 checkit
"$RSYNC -ai --info=backup '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
24 cat "$srcdir"/[fgpr
]*.
[ch
] > "$name1"
25 cat "$srcdir"/[etw
]*.
[ch
] > "$name2"
27 checktee
"$RSYNC -ai --info=backup --no-whole-file --backup '$fromdir/' '$todir/'"
28 for fn
in deep
/name1 deep
/name2
; do
29 grep "backed up $fn to $fn~" "$outfile" >/dev
/null || test_fail
"no backup message output for $fn"
30 diff $diffopt "$fromdir/$fn" "$todir/$fn" || test_fail
"copy of $fn failed"
31 diff $diffopt "$chkdir/$fn" "$todir/$fn~" || test_fail
"backup of $fn to $fn~ failed"
32 mv "$todir/$fn~" "$todir/$fn"
35 echo deleted-file
>"$todir/dname"
36 cp_touch
"$todir/dname" "$chkdir"
38 checkit
"$RSYNC -ai --info=backup --no-whole-file --delete-delay \
39 --backup --backup-dir='$bakdir' '$fromdir/' '$todir/'" "$fromdir" "$todir" \
42 for fn
in deep
/name1 deep
/name2
; do
43 grep "backed up $fn to .*/$fn$" "$outfile" >/dev
/null || test_fail
"no backup message output for $fn"
45 diff -r $diffopt "$chkdir" "$bakdir" || test_fail
"backup dir contents are bogus"
48 checkit
"$RSYNC -ai --info=backup --del '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
49 cat "$srcdir"/[efgr
]*.
[ch
] > "$name1"
50 cat "$srcdir"/[ew
]*.
[ch
] > "$name2"
52 checkit
"$RSYNC -ai --info=backup --inplace --no-whole-file --backup --backup-dir='$bakdir' '$fromdir/' '$todir/'" "$fromdir" "$todir" \
55 for fn
in deep
/name1 deep
/name2
; do
56 grep "backed up $fn to .*/$fn$" "$outfile" >/dev
/null || test_fail
"no backup message output for $fn"
58 diff -r $diffopt "$chkdir" "$bakdir" || test_fail
"backup dir contents are bogus"
60 checkit
"$RSYNC -ai --info=backup --inplace --no-whole-file '$fromdir/' '$bakdir/'" "$fromdir" "$bakdir"
62 # The script would have aborted on error, so getting here means we've won.