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

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: 
        !            14: makepath "$fromdir/deep" "$bakdir"
        !            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: 
        !            23: checkit "$RSYNC -avv '$fromdir/' '$todir/'" "$fromdir" "$todir"
        !            24: 
        !            25: checkit "$RSYNC -avv '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
        !            26: cat "$srcdir"/[fgpr]*.[ch] > "$name1"
        !            27: cat "$srcdir"/[etw]*.[ch] > "$name2"
        !            28: 
        !            29: $RSYNC -avv --no-whole-file --backup "$fromdir/" "$todir/" \
        !            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: 
        !            41: checkit "$RSYNC -avv --no-whole-file --delete-delay \
        !            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: 
        !            51: checkit "$RSYNC -avv --del '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
        !            52: cat "$srcdir"/[efgr]*.[ch] > "$name1"
        !            53: cat "$srcdir"/[ew]*.[ch] > "$name2"
        !            54: 
        !            55: checkit "$RSYNC -avv --inplace --no-whole-file --backup --backup-dir='$bakdir' '$fromdir/' '$todir/'" "$fromdir" "$todir" \
        !            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: 
        !            63: checkit "$RSYNC -avv --inplace --no-whole-file '$fromdir/' '$bakdir/'" "$fromdir" "$bakdir"
        !            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>