metadata in dryrun mode

Mark Santcroos marks at ripe.net
Fri Apr 5 06:12:18 EST 2002


On Wed, Apr 03, 2002 at 10:10:42AM +1000, Martin Pool wrote:
> Please try to write a test script for this while you're there, either
> as a standalone shell script or integrated with 'make check'.

Hi Martin,

Find it attached.

Mark

-- 
Mark Santcroos				RIPE Network Coordination Centre
http://www.ripe.net/home/mark/		New Projects Group/TTM
-------------- next part --------------
#! /bin/sh
#
# Copyright (C) 2002 by Mark Santcroos <marks at ripe.net>
#
# This program is distributable under the terms of the GNU GPL (see
# COPYING).
#
#
# filename: dry_run_meta.test
#
# This test will check if rsync in dry_run mode will:
# - report permission diffs
# - report ownership diffs
# - report content diffs
#
# TODO: there is still a bug that it reports directories twice
#       (see last two lines of reference output)

. $srcdir/testsuite/rsync.fns

set -x

# setup temp dirs
fromdir="$scratchdir/from"
todir="$scratchdir/to"

# create source dir
mkdir "$fromdir"
mkdir "$todir"

# fill identical source and dest dir
touch "$fromdir/afile"
touch "$todir/afile"
touch "$fromdir/bfile"
touch "$todir/bfile"
touch "$fromdir/cfile"
touch "$todir/cfile"
mkdir "$fromdir/ddir"
mkdir "$todir/ddir"
touch "$fromdir/ddir/efile"
touch "$todir/ddir/efile"
touch "$fromdir/ddir/ffile"
touch "$todir/ddir/ffile"
touch "$fromdir/ddir/gfile" 
touch "$todir/ddir/gfile" 
touch "$fromdir/ddir/hfile" 
touch "$todir/ddir/hfile" 

# now create some differences
chmod 644 "$fromdir/afile"
chmod 600 "$todir/afile"
chown 1234 "$fromdir/bfile" || test_skipped "Can't chown (probably need root)"
chown 4321 "$todir/bfile" || test_skipped "Can't chown (probably need root)"
chgrp 1234 "$fromdir/cfile"
chgrp 4321 "$todir/cfile"
chmod 700 "$fromdir/ddir"
chmod 755 "$todir/ddir"
chown 1234 "$fromdir/ddir" || test_skipped "Can't chown (probably need root)"
chown 4321 "$todir/ddir" || test_skipped "Can't chown (probably need root)"
chgrp 1234 "$todir/ddir"
chgrp 4321 "$todir/ddir"
chmod 644 "$fromdir/ddir/efile"
chmod 600 "$todir/ddir/efile"
chown 1234 "$fromdir/ddir/ffile" || test_skipped "Can't chown (probably need root)"
chown 4321 "$todir/ddir/ffile" || test_skipped "Can't chown (probably need root)"
chgrp 1234 "$fromdir/ddir/gfile"
chgrp 4321 "$todir/ddir/gfile"
date > "$fromdir/ddir/hfile"
sleep 2
date > "$todir/ddir/hfile"

# run sync and compare with expected output
$RSYNC -anv "$fromdir/" "$todir/" > "$scratchdir/slash.out"
diff --ignore-matching-lines="^building file list" --ignore-matching-lines="^wrote [0123456789]+ bytes" --ignore-matching-lines="^total size is " -c "$scratchdir/slash.out" - <<EOF_MARKER
afile: permission diff
bfile: owner diff
cfile: owner diff
ddir/: owner diff
ddir/: permission diff
ddir/efile: permission diff
ddir/ffile: owner diff
ddir/gfile: owner diff
ddir/hfile
ddir/: owner diff
ddir/: permission diff
EOF_MARKER

exit 0
# last [] may have failed but if we get here then we've won


More information about the rsync mailing list