Annotation of embedaddon/rsync/testsuite/backup.test, revision 1.1.1.2

1.1       misho       1: #! /bin/sh
                      2: 
                      3: # Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
                      4: 
                      5: # This program is distributable under the terms of the GNU GPL (see
                      6: # COPYING).
                      7: 
                      8: # Test that the --backup option works right.
                      9: 
                     10: . "$suitedir/rsync.fns"
                     11: 
                     12: bakdir="$tmpdir/bak"
                     13: 
1.1.1.2 ! misho      14: makepath "$fromdir/deep" "$bakdir/dname"
1.1       misho      15: name1="$fromdir/deep/name1"
                     16: name2="$fromdir/deep/name2"
                     17: 
                     18: outfile="$scratchdir/rsync.out"
                     19: 
                     20: cat "$srcdir"/[gr]*.[ch] > "$name1"
                     21: cat "$srcdir"/[et]*.[ch] > "$name2"
                     22: 
1.1.1.2 ! misho      23: checkit "$RSYNC -ai --info=backup '$fromdir/' '$todir/'" "$fromdir" "$todir"
1.1       misho      24: 
1.1.1.2 ! misho      25: checkit "$RSYNC -ai --info=backup '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
1.1       misho      26: cat "$srcdir"/[fgpr]*.[ch] > "$name1"
                     27: cat "$srcdir"/[etw]*.[ch] > "$name2"
                     28: 
1.1.1.2 ! misho      29: $RSYNC -ai --info=backup --no-whole-file --backup "$fromdir/" "$todir/" \
1.1       misho      30:     | tee "$outfile"
                     31: for fn in deep/name1 deep/name2; do
                     32:     grep "backed up $fn to $fn~" "$outfile" >/dev/null || test_fail "no backup message output for $fn"
                     33:     diff $diffopt "$fromdir/$fn" "$todir/$fn" || test_fail "copy of $fn failed"
                     34:     diff $diffopt "$chkdir/$fn" "$todir/$fn~" || test_fail "backup of $fn to $fn~ failed"
                     35:     mv "$todir/$fn~" "$todir/$fn"
                     36: done
                     37: 
                     38: echo deleted-file >"$todir/dname"
                     39: cp_touch "$todir/dname" "$chkdir"
                     40: 
1.1.1.2 ! misho      41: checkit "$RSYNC -ai --info=backup --no-whole-file --delete-delay \
1.1       misho      42:     --backup --backup-dir='$bakdir' '$fromdir/' '$todir/'" "$fromdir" "$todir" \
                     43:     | tee "$outfile"
                     44: 
                     45: for fn in deep/name1 deep/name2; do
                     46:     grep "backed up $fn to .*/$fn$" "$outfile" >/dev/null || test_fail "no backup message output for $fn"
                     47: done
                     48: diff -r $diffopt "$chkdir" "$bakdir" || test_fail "backup dir contents are bogus"
                     49: rm "$bakdir/dname"
                     50: 
1.1.1.2 ! misho      51: checkit "$RSYNC -ai --info=backup --del '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
1.1       misho      52: cat "$srcdir"/[efgr]*.[ch] > "$name1"
                     53: cat "$srcdir"/[ew]*.[ch] > "$name2"
                     54: 
1.1.1.2 ! misho      55: checkit "$RSYNC -ai --info=backup --inplace --no-whole-file --backup --backup-dir='$bakdir' '$fromdir/' '$todir/'" "$fromdir" "$todir" \
1.1       misho      56:     | tee "$outfile"
                     57: 
                     58: for fn in deep/name1 deep/name2; do
                     59:     grep "backed up $fn to .*/$fn$" "$outfile" >/dev/null || test_fail "no backup message output for $fn"
                     60: done
                     61: diff -r $diffopt "$chkdir" "$bakdir" || test_fail "backup dir contents are bogus"
                     62: 
1.1.1.2 ! misho      63: checkit "$RSYNC -ai --info=backup --inplace --no-whole-file '$fromdir/' '$bakdir/'" "$fromdir" "$bakdir"
1.1       misho      64: 
                     65: # The script would have aborted on error, so getting here means we've won.
                     66: exit 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>